Merge branch 'master' into careminster-presence-refactor

avinationmerge
Melanie 2010-08-21 00:32:26 +01:00
commit f8ff98577e
24 changed files with 675 additions and 550 deletions

View File

@ -142,7 +142,7 @@ namespace OpenSim.Framework.Capabilities
m_httpListenPort = httpPort; m_httpListenPort = httpPort;
if (httpServer.UseSSL) if (httpServer != null && httpServer.UseSSL)
{ {
m_httpListenPort = httpServer.SSLPort; m_httpListenPort = httpServer.SSLPort;
httpListen = httpServer.SSLCommonName; httpListen = httpServer.SSLCommonName;
@ -151,7 +151,7 @@ namespace OpenSim.Framework.Capabilities
m_agentID = agent; m_agentID = agent;
m_dumpAssetsToFile = dumpAssetsToFile; m_dumpAssetsToFile = dumpAssetsToFile;
m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort, httpServer.UseSSL); m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort, (httpServer == null) ? false : httpServer.UseSSL);
m_regionName = regionName; m_regionName = regionName;
} }

View File

@ -74,7 +74,7 @@ namespace OpenSim.Framework.Capabilities
m_httpListenerHostName = httpListenerHostname; m_httpListenerHostName = httpListenerHostname;
m_httpListenerPort = httpListenerPort; m_httpListenerPort = httpListenerPort;
m_useSSL = https; m_useSSL = https;
if (m_useSSL) if (httpListener != null && m_useSSL)
{ {
m_httpListenerHostName = httpListener.SSLCommonName; m_httpListenerHostName = httpListener.SSLCommonName;
m_httpListenerPort = httpListener.SSLPort; m_httpListenerPort = httpListener.SSLPort;

View File

@ -83,7 +83,9 @@ namespace OpenSim.Framework
/// <summary>Finished, Sim Changed</summary> /// <summary>Finished, Sim Changed</summary>
FinishedViaNewSim = 1 << 28, FinishedViaNewSim = 1 << 28,
/// <summary>Finished, Same Sim</summary> /// <summary>Finished, Same Sim</summary>
FinishedViaSameSim = 1 << 29 FinishedViaSameSim = 1 << 29,
/// <summary>Agent coming into the grid from another grid</summary>
ViaHGLogin = 1 << 30
} }
} }

View File

@ -181,16 +181,8 @@ namespace OpenSim.Framework
throw new ArgumentException("[NetworkUtil] Unable to resolve defaultHostname to an IPv4 address for an IPv4 client"); throw new ArgumentException("[NetworkUtil] Unable to resolve defaultHostname to an IPv4 address for an IPv4 client");
} }
static IPAddress externalIPAddress;
static NetworkUtil() static NetworkUtil()
{ {
try
{
externalIPAddress = GetExternalIP();
}
catch { /* ignore */ }
try try
{ {
foreach (NetworkInterface ni in NetworkInterface.GetAllNetworkInterfaces()) foreach (NetworkInterface ni in NetworkInterface.GetAllNetworkInterfaces())
@ -254,79 +246,5 @@ namespace OpenSim.Framework
return defaultHostname; return defaultHostname;
} }
public static IPAddress GetExternalIPOf(IPAddress user)
{
if (externalIPAddress == null)
return user;
if (user.ToString() == "127.0.0.1")
{
m_log.Info("[NetworkUtil] 127.0.0.1 user detected, sending '" + externalIPAddress + "' instead of '" + user + "'");
return externalIPAddress;
}
// Check if we're accessing localhost.
foreach (IPAddress host in Dns.GetHostAddresses(Dns.GetHostName()))
{
if (host.Equals(user) && host.AddressFamily == AddressFamily.InterNetwork)
{
m_log.Info("[NetworkUtil] Localhost user detected, sending '" + externalIPAddress + "' instead of '" + user + "'");
return externalIPAddress;
}
}
// Check for same LAN segment
foreach (KeyValuePair<IPAddress, IPAddress> subnet in m_subnets)
{
byte[] subnetBytes = subnet.Value.GetAddressBytes();
byte[] localBytes = subnet.Key.GetAddressBytes();
byte[] destBytes = user.GetAddressBytes();
if (subnetBytes.Length != destBytes.Length || subnetBytes.Length != localBytes.Length)
return user;
bool valid = true;
for (int i = 0; i < subnetBytes.Length; i++)
{
if ((localBytes[i] & subnetBytes[i]) != (destBytes[i] & subnetBytes[i]))
{
valid = false;
break;
}
}
if (subnet.Key.AddressFamily != AddressFamily.InterNetwork)
valid = false;
if (valid)
{
m_log.Info("[NetworkUtil] Local LAN user detected, sending '" + externalIPAddress + "' instead of '" + user + "'");
return externalIPAddress;
}
}
// Otherwise, return user address
return user;
}
private static IPAddress GetExternalIP()
{
string whatIsMyIp = "http://www.whatismyip.com/automation/n09230945.asp";
WebClient wc = new WebClient();
UTF8Encoding utf8 = new UTF8Encoding();
string requestHtml = "";
try
{
requestHtml = utf8.GetString(wc.DownloadData(whatIsMyIp));
}
catch (WebException we)
{
m_log.Info("[NetworkUtil]: Exception in GetExternalIP: " + we.ToString());
return null;
}
IPAddress externalIp = IPAddress.Parse(requestHtml);
return externalIp;
}
} }
} }

View File

@ -394,7 +394,7 @@ namespace OpenSim.Framework
if (!File.Exists(filename)) // New region config request if (!File.Exists(filename)) // New region config request
{ {
IniConfigSource newFile = new IniConfigSource(); IniConfigSource newFile = new IniConfigSource();
ReadNiniConfig(newFile, String.Empty); ReadNiniConfig(newFile, configName);
newFile.Save(filename); newFile.Save(filename);

View File

@ -308,8 +308,13 @@ namespace OpenSim
"Persist objects to the database now", RunCommand); "Persist objects to the database now", RunCommand);
m_console.Commands.AddCommand("region", false, "create region", m_console.Commands.AddCommand("region", false, "create region",
"create region", "create region [\"region name\"] <region_file.ini>",
"Create a new region", HandleCreateRegion); "Create a new region.",
"The settings for \"region name\" are read from <region_file.ini>."
+ " If \"region name\" does not exist in <region_file.ini>, it will be added." + Environment.NewLine
+ "Without \"region name\", the first region found in <region_file.ini> will be created." + Environment.NewLine
+ "If <region_file.ini> does not exist, it will be created.",
HandleCreateRegion);
m_console.Commands.AddCommand("region", false, "restart", m_console.Commands.AddCommand("region", false, "restart",
"restart", "restart",
@ -513,47 +518,47 @@ namespace OpenSim
/// Creates a new region based on the parameters specified. This will ask the user questions on the console /// Creates a new region based on the parameters specified. This will ask the user questions on the console
/// </summary> /// </summary>
/// <param name="module"></param> /// <param name="module"></param>
/// <param name="cmd">0,1,region name, region XML file</param> /// <param name="cmd">0,1,region name, region ini or XML file</param>
private void HandleCreateRegion(string module, string[] cmd) private void HandleCreateRegion(string module, string[] cmd)
{ {
if (cmd.Length < 4) string regionName = string.Empty;
string regionFile = string.Empty;
if (cmd.Length == 3)
{ {
MainConsole.Instance.Output("Usage: create region <region name> <region_file.ini>"); regionFile = cmd[2];
}
else if (cmd.Length > 3)
{
regionName = cmd[2];
regionFile = cmd[3];
}
string extension = Path.GetExtension(regionFile).ToLower();
bool isXml = extension.Equals(".xml");
bool isIni = extension.Equals(".ini");
if (!isXml && !isIni)
{
MainConsole.Instance.Output("Usage: create region [\"region name\"] <region_file.ini>");
return; return;
} }
if (cmd[3].EndsWith(".xml")) if (!Path.IsPathRooted(regionFile))
{ {
string regionsDir = ConfigSource.Source.Configs["Startup"].GetString("regionload_regionsdir", "Regions").Trim(); string regionsDir = ConfigSource.Source.Configs["Startup"].GetString("regionload_regionsdir", "Regions").Trim();
string regionFile = String.Format("{0}/{1}", regionsDir, cmd[3]); regionFile = Path.Combine(regionsDir, regionFile);
// Allow absolute and relative specifiers
if (cmd[3].StartsWith("/") || cmd[3].StartsWith("\\") || cmd[3].StartsWith(".."))
regionFile = cmd[3];
IScene scene;
RegionInfo regInfo = new RegionInfo(cmd[2], regionFile, false, ConfigSource.Source);
PopulateRegionEstateInfo(regInfo);
CreateRegion(regInfo, true, out scene);
regInfo.EstateSettings.Save();
} }
else if (cmd[3].EndsWith(".ini"))
{
string regionsDir = ConfigSource.Source.Configs["Startup"].GetString("regionload_regionsdir", "Regions").Trim();
string regionFile = String.Format("{0}/{1}", regionsDir, cmd[3]);
// Allow absolute and relative specifiers
if (cmd[3].StartsWith("/") || cmd[3].StartsWith("\\") || cmd[3].StartsWith(".."))
regionFile = cmd[3];
IScene scene; RegionInfo regInfo;
RegionInfo regInfo = new RegionInfo(cmd[2], regionFile, false, ConfigSource.Source, cmd[2]); if (isXml)
PopulateRegionEstateInfo(regInfo); {
CreateRegion(regInfo, true, out scene); regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source);
regInfo.EstateSettings.Save();
} }
else else
{ {
MainConsole.Instance.Output("Usage: create region <region name> <region_file.ini>"); regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source, regionName);
return;
} }
IScene scene;
PopulateRegionEstateInfo(regInfo);
CreateRegion(regInfo, true, out scene);
regInfo.EstateSettings.Save();
} }
/// <summary> /// <summary>

View File

@ -109,7 +109,7 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities
Caps caps Caps caps
= new Caps(m_scene, = new Caps(m_scene,
m_scene.AssetService, MainServer.Instance, m_scene.RegionInfo.ExternalHostName, m_scene.AssetService, MainServer.Instance, m_scene.RegionInfo.ExternalHostName,
MainServer.Instance.Port, (MainServer.Instance == null) ? 0: MainServer.Instance.Port,
capsObjectPath, agentId, m_scene.DumpAssetsToFile, m_scene.RegionInfo.RegionName); capsObjectPath, agentId, m_scene.DumpAssetsToFile, m_scene.RegionInfo.RegionName);
caps.RegisterHandlers(); caps.RegisterHandlers();

View File

@ -51,15 +51,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
m_scene.RegisterModuleInterface<IDialogModule>(this); m_scene.RegisterModuleInterface<IDialogModule>(this);
m_scene.AddCommand( m_scene.AddCommand(
this, "alert", "alert <first> <last> <message>", "Send an alert to a user", HandleAlertConsoleCommand); this, "alert", "alert <first> <last> <message>",
"Send an alert to a user",
HandleAlertConsoleCommand);
m_scene.AddCommand( m_scene.AddCommand(
this, "alert general", "alert general <message>", "Send an alert to everyone", HandleAlertConsoleCommand); this, "alert general", "alert [general] <message>",
"Send an alert to everyone",
m_scene.AddCommand( "If keyword 'general' is omitted, then <message> must be surrounded by quotation marks.",
this, "alert dialog", "alert dialog <message>", "Send a dialog alert to everyone", HandleAlertConsoleCommand); HandleAlertConsoleCommand);
} }
public void PostInitialise() {} public void PostInitialise() {}
@ -102,9 +102,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
m_scene.ForEachScenePresence(delegate(ScenePresence presence) m_scene.ForEachScenePresence(delegate(ScenePresence presence)
{ {
if (!presence.IsChildAgent) if (!presence.IsChildAgent)
{
presence.ControllingClient.SendAlertMessage(message); presence.ControllingClient.SendAlertMessage(message);
}
}); });
} }
@ -180,28 +178,49 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
if (m_scene.ConsoleScene() != null && m_scene.ConsoleScene() != m_scene) if (m_scene.ConsoleScene() != null && m_scene.ConsoleScene() != m_scene)
return; return;
if (cmdparams[1] == "general") bool isGeneral = false;
{ string firstName = string.Empty;
string message = CombineParams(cmdparams, 2); string lastName = string.Empty;
string message = string.Empty;
m_log.InfoFormat( if (cmdparams.Length > 1)
"[DIALOG]: Sending general alert in region {0} with message {1}", m_scene.RegionInfo.RegionName, message); {
SendGeneralAlert(message); firstName = cmdparams[1];
isGeneral = firstName.ToLower().Equals("general");
} }
else if (cmdparams[1] == "dialog") if (cmdparams.Length == 2 && !isGeneral)
{ {
string message = CombineParams(cmdparams, 2); // alert "message"
message = cmdparams[1];
m_log.InfoFormat( isGeneral = true;
"[DIALOG]: Sending dialog alert in region {0} with message {1}", m_scene.RegionInfo.RegionName, message); }
SendNotificationToUsersInRegion(UUID.Zero, "System", message); else if (cmdparams.Length > 2 && isGeneral)
{
// alert general <message>
message = CombineParams(cmdparams, 2);
}
else if (cmdparams.Length > 3)
{
// alert <first> <last> <message>
lastName = cmdparams[2];
message = CombineParams(cmdparams, 3);
} }
else else
{ {
string firstName = cmdparams[1]; OpenSim.Framework.Console.MainConsole.Instance.Output(
string lastName = cmdparams[2]; "Usage: alert \"message\" | alert general <message> | alert <first> <last> <message>");
string message = CombineParams(cmdparams, 3); return;
}
if (isGeneral)
{
m_log.InfoFormat(
"[DIALOG]: Sending general alert in region {0} with message {1}",
m_scene.RegionInfo.RegionName, message);
SendGeneralAlert(message);
}
else
{
m_log.InfoFormat( m_log.InfoFormat(
"[DIALOG]: Sending alert in region {0} to {1} {2} with message {3}", "[DIALOG]: Sending alert in region {0} to {1} {2} with message {3}",
m_scene.RegionInfo.RegionName, firstName, lastName, message); m_scene.RegionInfo.RegionName, firstName, lastName, message);

View File

@ -100,7 +100,7 @@ namespace OpenSim.Region.CoreModules.InterGrid
bool enabled = false; bool enabled = false;
IConfig cfg = null; IConfig cfg = null;
IConfig httpcfg = null; IConfig httpcfg = null;
IConfig startupcfg = null; // IConfig startupcfg = null;
try try
{ {
cfg = config.Configs["OpenGridProtocol"]; cfg = config.Configs["OpenGridProtocol"];
@ -117,14 +117,14 @@ namespace OpenSim.Region.CoreModules.InterGrid
{ {
} }
try // try
{ // {
startupcfg = config.Configs["Startup"]; // startupcfg = config.Configs["Startup"];
} // }
catch (NullReferenceException) // catch (NullReferenceException)
{ // {
//
} // }
// if (startupcfg != null) // if (startupcfg != null)
// { // {

View File

@ -2584,18 +2584,25 @@ 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)
{ {
AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode);
bool vialogin = false; bool vialogin = false;
m_clientManager.Add(client); if (aCircuit == null) // no good, didn't pass NewUserConnection successfully
return;
vialogin = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 ||
(aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0;
CheckHeartbeat(); CheckHeartbeat();
SubscribeToClientEvents(client);
ScenePresence presence; ScenePresence presence;
if (m_restorePresences.ContainsKey(client.AgentId)) if (m_restorePresences.ContainsKey(client.AgentId))
{ {
m_log.DebugFormat("[SCENE]: Restoring agent {0} {1} in {2}", client.Name, client.AgentId, RegionInfo.RegionName); m_log.DebugFormat("[SCENE]: Restoring agent {0} {1} in {2}", client.Name, client.AgentId, RegionInfo.RegionName);
m_clientManager.Add(client);
SubscribeToClientEvents(client);
presence = m_restorePresences[client.AgentId]; presence = m_restorePresences[client.AgentId];
m_restorePresences.Remove(client.AgentId); m_restorePresences.Remove(client.AgentId);
@ -2618,31 +2625,13 @@ namespace OpenSim.Region.Framework.Scenes
} }
else else
{ {
AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); if (GetScenePresence(client.AgentId) == null) // ensure there is no SP here
// Do the verification here
System.Net.IPEndPoint ep = (System.Net.IPEndPoint)client.GetClientEP();
if (aCircuit != null)
{ {
if (!VerifyClient(aCircuit, ep, out vialogin))
{
// uh-oh, this is fishy
m_log.WarnFormat("[SCENE]: Agent {0} with session {1} connecting with unidentified end point {2}. Refusing service.",
client.AgentId, client.SessionId, ep.ToString());
try
{
client.Close();
}
catch (Exception e)
{
m_log.DebugFormat("[SCENE]: Exception while closing aborted client: {0}", e.StackTrace);
}
return;
}
}
m_log.Debug("[SCENE]: Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName); m_log.Debug("[SCENE]: Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName);
m_clientManager.Add(client);
SubscribeToClientEvents(client);
ScenePresence sp = CreateAndAddScenePresence(client); ScenePresence sp = CreateAndAddScenePresence(client);
if (aCircuit != null) if (aCircuit != null)
sp.Appearance = aCircuit.Appearance; sp.Appearance = aCircuit.Appearance;
@ -2656,28 +2645,30 @@ namespace OpenSim.Region.Framework.Scenes
Util.FireAndForget(delegate(object o) { sp.RezAttachments(); }); Util.FireAndForget(delegate(object o) { sp.RezAttachments(); });
} }
} }
}
if (GetScenePresence(client.AgentId) != null)
{
m_LastLogin = Util.EnvironmentTickCount(); m_LastLogin = Util.EnvironmentTickCount();
EventManager.TriggerOnNewClient(client); EventManager.TriggerOnNewClient(client);
if (vialogin) if (vialogin)
EventManager.TriggerOnClientLogin(client); EventManager.TriggerOnClientLogin(client);
} }
}
private bool VerifyClient(AgentCircuitData aCircuit, System.Net.IPEndPoint ep, out bool vialogin) private bool VerifyClient(AgentCircuitData aCircuit, System.Net.IPEndPoint ep, out bool vialogin)
{ {
vialogin = false; vialogin = false;
// Do the verification here // Do the verification here
if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0) if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0)
{ {
m_log.DebugFormat("[SCENE]: Incoming client {0} {1} in region {2} via Login", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); m_log.DebugFormat("[SCENE]: Incoming client {0} {1} in region {2} via HG login", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName);
vialogin = true; vialogin = true;
IUserAgentVerificationModule userVerification = RequestModuleInterface<IUserAgentVerificationModule>(); IUserAgentVerificationModule userVerification = RequestModuleInterface<IUserAgentVerificationModule>();
if (userVerification != null && ep != null) if (userVerification != null && ep != null)
{ {
System.Net.IPAddress addr = NetworkUtil.GetExternalIPOf(ep.Address); if (!userVerification.VerifyClient(aCircuit, ep.Address.ToString()))
if (!userVerification.VerifyClient(aCircuit, /*ep.Address.ToString() */ addr.ToString()))
{ {
// uh-oh, this is fishy // uh-oh, this is fishy
m_log.DebugFormat("[SCENE]: User Client Verification for {0} {1} in {2} returned false", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); m_log.DebugFormat("[SCENE]: User Client Verification for {0} {1} in {2} returned false", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName);
@ -2688,6 +2679,13 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
else if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0)
{
m_log.DebugFormat("[SCENE]: Incoming client {0} {1} in region {2} via regular login. Client IP verification not performed.",
aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName);
vialogin = true;
}
return true; return true;
} }
@ -3343,7 +3341,8 @@ namespace OpenSim.Region.Framework.Scenes
/// also return a reason.</returns> /// also return a reason.</returns>
public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason) public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason)
{ {
TeleportFlags tp = (TeleportFlags)teleportFlags; bool vialogin = ((teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0 ||
(teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0);
reason = String.Empty; reason = String.Empty;
//Teleport flags: //Teleport flags:
@ -3380,7 +3379,7 @@ namespace OpenSim.Region.Framework.Scenes
ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y);
//On login test land permisions //On login test land permisions
if (tp == TeleportFlags.ViaLogin) if (vialogin)
{ {
if (land != null && !TestLandRestrictions(agent, land, out reason)) if (land != null && !TestLandRestrictions(agent, land, out reason))
{ {
@ -3440,7 +3439,7 @@ namespace OpenSim.Region.Framework.Scenes
agent.teleportFlags = teleportFlags; agent.teleportFlags = teleportFlags;
m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent);
if (tp == TeleportFlags.ViaLogin) if (vialogin)
{ {
if (TestBorderCross(agent.startpos, Cardinals.E)) if (TestBorderCross(agent.startpos, Cardinals.E))
{ {
@ -3561,7 +3560,7 @@ namespace OpenSim.Region.Framework.Scenes
IPresenceService presence = RequestModuleInterface<IPresenceService>(); IPresenceService presence = RequestModuleInterface<IPresenceService>();
if (presence == null) if (presence == null)
{ {
reason = String.Format("Failed to verify user {0} {1} in region {2}. Presence service does not exist.", agent.firstname, agent.lastname, RegionInfo.RegionName); reason = String.Format("Failed to verify user presence in the grid for {0} {1} in region {2}. Presence service does not exist.", agent.firstname, agent.lastname, RegionInfo.RegionName);
return false; return false;
} }
@ -3569,7 +3568,7 @@ namespace OpenSim.Region.Framework.Scenes
if (pinfo == null) if (pinfo == null)
{ {
reason = String.Format("Failed to verify user {0} {1}, access denied to region {2}.", agent.firstname, agent.lastname, RegionInfo.RegionName); reason = String.Format("Failed to verify user presence in the grid for {0} {1}, access denied to region {2}.", agent.firstname, agent.lastname, RegionInfo.RegionName);
return false; return false;
} }

View File

@ -104,8 +104,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
agent.AgentID = agent1; agent.AgentID = agent1;
agent.firstname = firstName; agent.firstname = firstName;
agent.lastname = "testlastname"; agent.lastname = "testlastname";
agent.SessionID = UUID.Zero; agent.SessionID = UUID.Random();
agent.SecureSessionID = UUID.Zero; agent.SecureSessionID = UUID.Random();
agent.circuitcode = 123; agent.circuitcode = 123;
agent.BaseFolder = UUID.Zero; agent.BaseFolder = UUID.Zero;
agent.InventoryFolder = UUID.Zero; agent.InventoryFolder = UUID.Zero;
@ -114,6 +114,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests
agent.ChildrenCapSeeds = new Dictionary<ulong, string>(); agent.ChildrenCapSeeds = new Dictionary<ulong, string>();
agent.child = true; agent.child = true;
if (scene.PresenceService == null)
Console.WriteLine("Presence Service is null");
scene.PresenceService.LoginAgent(agent.AgentID.ToString(), agent.SessionID, agent.SecureSessionID);
string reason; string reason;
scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason); scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason);
testclient = new TestClient(agent, scene); testclient = new TestClient(agent, scene);

View File

@ -183,6 +183,8 @@ namespace OpenSim.Server.Handlers.Simulation
resp["reason"] = OSD.FromString(reason); resp["reason"] = OSD.FromString(reason);
resp["success"] = OSD.FromBoolean(result); resp["success"] = OSD.FromBoolean(result);
// Let's also send out the IP address of the caller back to the caller (HG 1.5)
resp["your_ip"] = OSD.FromString(GetCallerIP(request));
// TODO: add reason if not String.Empty? // TODO: add reason if not String.Empty?
responsedata["int_response_code"] = HttpStatusCode.OK; responsedata["int_response_code"] = HttpStatusCode.OK;
@ -375,6 +377,24 @@ namespace OpenSim.Server.Handlers.Simulation
{ {
m_SimulationService.ReleaseAgent(regionID, id, ""); m_SimulationService.ReleaseAgent(regionID, id, "");
} }
private string GetCallerIP(Hashtable req)
{
if (req.ContainsKey("headers"))
{
try
{
Hashtable headers = (Hashtable)req["headers"];
if (headers.ContainsKey("remote_addr") && headers["remote_addr"] != null)
return headers["remote_addr"].ToString();
}
catch (Exception e)
{
m_log.WarnFormat("[AGENT HANDLER]: exception in GetCallerIP: {0}", e.Message);
}
}
return string.Empty;
}
} }
} }

View File

@ -38,6 +38,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using OpenMetaverse; using OpenMetaverse;
using OpenMetaverse.Imaging; using OpenMetaverse.Imaging;
using OpenMetaverse.StructuredData;
using Nwc.XmlRpc; using Nwc.XmlRpc;
using log4net; using log4net;
@ -278,5 +279,48 @@ namespace OpenSim.Services.Connectors.Hypergrid
return null; return null;
} }
public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string myipaddress, out string reason)
{
HttpWebRequest AgentCreateRequest = null;
myipaddress = String.Empty;
reason = String.Empty;
if (SendRequest(destination, aCircuit, flags, out reason, out AgentCreateRequest))
{
string response = GetResponse(AgentCreateRequest, out reason);
bool success = true;
UnpackResponse(response, out success, out reason, out myipaddress);
return success;
}
return false;
}
protected void UnpackResponse(string response, out bool result, out string reason, out string ipaddress)
{
result = true;
reason = string.Empty;
ipaddress = string.Empty;
if (!String.IsNullOrEmpty(response))
{
try
{
// we assume we got an OSDMap back
OSDMap r = Util.GetOSDMap(response);
result = r["success"].AsBoolean();
reason = r["reason"].AsString();
ipaddress = r["your_ip"].AsString();
}
catch (NullReferenceException e)
{
m_log.InfoFormat("[GATEKEEPER SERVICE CONNECTOR]: exception on UnpackResponse of DoCreateChildAgentCall {0}", e.Message);
reason = "Internal error";
result = false;
}
}
}
} }
} }

View File

@ -73,6 +73,13 @@ namespace OpenSim.Services.Connectors.Hypergrid
{ {
} }
public bool LoginAgentToGrid(AgentCircuitData agent, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint ipaddress, out string reason)
{
// not available over remote calls
reason = "Method not available over remote calls";
return false;
}
public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, out string reason) public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, out string reason)
{ {
reason = String.Empty; reason = String.Empty;

View File

@ -77,8 +77,26 @@ namespace OpenSim.Services.Connectors.Simulation
public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason) public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason)
{ {
HttpWebRequest AgentCreateRequest = null;
reason = String.Empty; reason = String.Empty;
if (SendRequest(destination, aCircuit, flags, out reason, out AgentCreateRequest))
{
string response = GetResponse(AgentCreateRequest, out reason);
bool success = true;
UnpackResponse(response, out success, out reason);
return success;
}
return false;
}
protected bool SendRequest(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason, out HttpWebRequest AgentCreateRequest)
{
reason = String.Empty;
AgentCreateRequest = null;
if (destination == null) if (destination == null)
{ {
reason = "Destination is null"; reason = "Destination is null";
@ -101,7 +119,7 @@ namespace OpenSim.Services.Connectors.Simulation
//Console.WriteLine(" >>> DoCreateChildAgentCall <<< " + uri); //Console.WriteLine(" >>> DoCreateChildAgentCall <<< " + uri);
HttpWebRequest AgentCreateRequest = (HttpWebRequest)WebRequest.Create(uri); AgentCreateRequest = (HttpWebRequest)WebRequest.Create(uri);
AgentCreateRequest.Method = "POST"; AgentCreateRequest.Method = "POST";
AgentCreateRequest.ContentType = "application/json"; AgentCreateRequest.ContentType = "application/json";
AgentCreateRequest.Timeout = 10000; AgentCreateRequest.Timeout = 10000;
@ -150,11 +168,18 @@ namespace OpenSim.Services.Connectors.Simulation
os.Close(); os.Close();
} }
return true;
}
protected string GetResponse(HttpWebRequest AgentCreateRequest, out string reason)
{
// Let's wait for the response // Let's wait for the response
//m_log.Info("[REMOTE SIMULATION CONNECTOR]: Waiting for a reply after DoCreateChildAgentCall"); //m_log.Info("[REMOTE SIMULATION CONNECTOR]: Waiting for a reply after DoCreateChildAgentCall");
reason = string.Empty;
WebResponse webResponse = null; WebResponse webResponse = null;
StreamReader sr = null; StreamReader sr = null;
string response = string.Empty;
try try
{ {
webResponse = AgentCreateRequest.GetResponse(); webResponse = AgentCreateRequest.GetResponse();
@ -166,37 +191,15 @@ namespace OpenSim.Services.Connectors.Simulation
{ {
sr = new StreamReader(webResponse.GetResponseStream()); sr = new StreamReader(webResponse.GetResponseStream());
string response = sr.ReadToEnd().Trim(); response = sr.ReadToEnd().Trim();
m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: DoCreateChildAgentCall reply was {0} ", response); m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: DoCreateChildAgentCall reply was {0} ", response);
if (!String.IsNullOrEmpty(response))
{
try
{
// we assume we got an OSDMap back
OSDMap r = Util.GetOSDMap(response);
bool success = r["success"].AsBoolean();
reason = r["reason"].AsString();
return success;
}
catch (NullReferenceException e)
{
m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of DoCreateChildAgentCall {0}", e.Message);
// check for old style response
if (response.ToLower().StartsWith("true"))
return true;
return false;
}
}
} }
} }
catch (WebException ex) catch (WebException ex)
{ {
m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of DoCreateChildAgentCall {0}", ex.Message); m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of DoCreateChildAgentCall {0}", ex.Message);
reason = "Destination did not reply"; reason = "Destination did not reply";
return false; return string.Empty;
} }
finally finally
{ {
@ -204,7 +207,33 @@ namespace OpenSim.Services.Connectors.Simulation
sr.Close(); sr.Close();
} }
return true; return response;
}
protected void UnpackResponse(string response, out bool result, out string reason)
{
result = true;
reason = string.Empty;
if (!String.IsNullOrEmpty(response))
{
try
{
// we assume we got an OSDMap back
OSDMap r = Util.GetOSDMap(response);
result = r["success"].AsBoolean();
reason = r["reason"].AsString();
}
catch (NullReferenceException e)
{
m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of DoCreateChildAgentCall {0}", e.Message);
// check for old style response
if (response.ToLower().StartsWith("true"))
result = true;
result = false;
}
}
} }
protected virtual OSDMap PackCreateAgentArguments(AgentCircuitData aCircuit, GridRegion destination, uint flags) protected virtual OSDMap PackCreateAgentArguments(AgentCircuitData aCircuit, GridRegion destination, uint flags)

View File

@ -225,9 +225,15 @@ namespace OpenSim.Services.HypergridService
// May want to authorize // May want to authorize
bool isFirstLogin = false;
// //
// Login the presence // Login the presence, if it's not there yet (by the login service)
// //
PresenceInfo presence = m_PresenceService.GetAgent(aCircuit.SessionID);
if (presence != null) // it has been placed there by the login service
isFirstLogin = true;
else
if (!m_PresenceService.LoginAgent(aCircuit.AgentID.ToString(), aCircuit.SessionID, aCircuit.SecureSessionID)) if (!m_PresenceService.LoginAgent(aCircuit.AgentID.ToString(), aCircuit.SessionID, aCircuit.SecureSessionID))
{ {
reason = "Unable to login presence"; reason = "Unable to login presence";
@ -274,7 +280,9 @@ namespace OpenSim.Services.HypergridService
// //
// Finally launch the agent at the destination // Finally launch the agent at the destination
// //
return m_SimulationService.CreateAgent(destination, aCircuit, (uint)Constants.TeleportFlags.ViaLogin, out reason); Constants.TeleportFlags loginFlag = isFirstLogin ? Constants.TeleportFlags.ViaLogin : Constants.TeleportFlags.ViaHGLogin;
m_log.DebugFormat("[GATEKEEPER SERVICE]: launching agent {0}", loginFlag);
return m_SimulationService.CreateAgent(destination, aCircuit, (uint)loginFlag, out reason);
} }
protected bool Authenticate(AgentCircuitData aCircuit) protected bool Authenticate(AgentCircuitData aCircuit)

View File

@ -131,10 +131,11 @@ namespace OpenSim.Services.HypergridService
return home; return home;
} }
public bool LoginAgentToGrid(AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, out string reason) public bool LoginAgentToGrid(AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint clientIP, out string reason)
{ {
m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} to grid {2}", m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}",
agentCircuit.firstname, agentCircuit.lastname, gatekeeper.ExternalHostName +":"+ gatekeeper.HttpPort); agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()),
gatekeeper.ExternalHostName +":"+ gatekeeper.HttpPort);
// Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination
GridRegion region = new GridRegion(gatekeeper); GridRegion region = new GridRegion(gatekeeper);
@ -149,11 +150,12 @@ namespace OpenSim.Services.HypergridService
//bool success = m_GatekeeperConnector.CreateAgent(region, agentCircuit, (uint)Constants.TeleportFlags.ViaLogin, out reason); //bool success = m_GatekeeperConnector.CreateAgent(region, agentCircuit, (uint)Constants.TeleportFlags.ViaLogin, out reason);
bool success = false; bool success = false;
string myExternalIP = string.Empty;
string gridName = "http://" + gatekeeper.ExternalHostName + ":" + gatekeeper.HttpPort; string gridName = "http://" + gatekeeper.ExternalHostName + ":" + gatekeeper.HttpPort;
if (m_GridName == gridName) if (m_GridName == gridName)
success = m_GatekeeperService.LoginAgent(agentCircuit, finalDestination, out reason); success = m_GatekeeperService.LoginAgent(agentCircuit, finalDestination, out reason);
else else
success = m_GatekeeperConnector.CreateAgent(region, agentCircuit, (uint)Constants.TeleportFlags.ViaLogin, out reason); success = m_GatekeeperConnector.CreateAgent(region, agentCircuit, (uint)Constants.TeleportFlags.ViaLogin, out myExternalIP, out reason);
if (!success) if (!success)
{ {
@ -167,15 +169,26 @@ namespace OpenSim.Services.HypergridService
return false; return false;
} }
m_log.DebugFormat("[USER AGENT SERVICE]: Gatekeeper sees me as {0}", myExternalIP);
// else set the IP addresses associated with this client
if (clientIP != null)
m_TravelingAgents[agentCircuit.SessionID].ClientIPAddress = clientIP.Address.ToString();
m_TravelingAgents[agentCircuit.SessionID].MyIpAddress = myExternalIP;
return true; return true;
} }
public void SetClientToken(UUID sessionID, string token) public bool LoginAgentToGrid(AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, out string reason)
{
reason = string.Empty;
return LoginAgentToGrid(agentCircuit, gatekeeper, finalDestination, null, out reason);
}
private void SetClientIP(UUID sessionID, string ip)
{ {
if (m_TravelingAgents.ContainsKey(sessionID)) if (m_TravelingAgents.ContainsKey(sessionID))
{ {
m_log.DebugFormat("[USER AGENT SERVICE]: Setting token {0} for session {1}", token, sessionID); m_log.DebugFormat("[USER AGENT SERVICE]: Setting IP {0} for session {1}", ip, sessionID);
m_TravelingAgents[sessionID].ClientToken = token; m_TravelingAgents[sessionID].ClientIPAddress = ip;
} }
} }
@ -196,7 +209,7 @@ namespace OpenSim.Services.HypergridService
travel.GridExternalName = "http://" + region.ExternalHostName + ":" + region.HttpPort; travel.GridExternalName = "http://" + region.ExternalHostName + ":" + region.HttpPort;
travel.ServiceToken = agentCircuit.ServiceSessionID; travel.ServiceToken = agentCircuit.ServiceSessionID;
if (old != null) if (old != null)
travel.ClientToken = old.ClientToken; travel.ClientIPAddress = old.ClientIPAddress;
return old; return old;
} }
@ -233,15 +246,22 @@ namespace OpenSim.Services.HypergridService
return travel.GridExternalName == thisGridExternalName; return travel.GridExternalName == thisGridExternalName;
} }
public bool VerifyClient(UUID sessionID, string token) public bool VerifyClient(UUID sessionID, string reportedIP)
{ {
if (m_BypassClientVerification) if (m_BypassClientVerification)
return true; return true;
m_log.DebugFormat("[USER AGENT SERVICE]: Verifying Client session {0} with token {1}", sessionID, token); m_log.DebugFormat("[USER AGENT SERVICE]: Verifying Client session {0} with reported IP {1}.",
sessionID, reportedIP);
if (m_TravelingAgents.ContainsKey(sessionID)) if (m_TravelingAgents.ContainsKey(sessionID))
return m_TravelingAgents[sessionID].ClientToken == token; {
m_log.DebugFormat("[USER AGENT SERVICE]: Comparing with login IP {0} and MyIP {1}",
m_TravelingAgents[sessionID].ClientIPAddress, m_TravelingAgents[sessionID].MyIpAddress);
return m_TravelingAgents[sessionID].ClientIPAddress == reportedIP ||
m_TravelingAgents[sessionID].MyIpAddress == reportedIP; // NATed
}
return false; return false;
} }
@ -266,7 +286,8 @@ namespace OpenSim.Services.HypergridService
public UUID UserID; public UUID UserID;
public string GridExternalName = string.Empty; public string GridExternalName = string.Empty;
public string ServiceToken = string.Empty; public string ServiceToken = string.Empty;
public string ClientToken = string.Empty; public string ClientIPAddress = string.Empty; // as seen from this user agent service
public string MyIpAddress = string.Empty; // the user agent service's external IP, as seen from the next gatekeeper
} }
} }

View File

@ -48,13 +48,15 @@ namespace OpenSim.Services.Interfaces
/// </summary> /// </summary>
public interface IUserAgentService public interface IUserAgentService
{ {
// called by login service only
bool LoginAgentToGrid(AgentCircuitData agent, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint clientIP, out string reason);
// called by simulators
bool LoginAgentToGrid(AgentCircuitData agent, GridRegion gatekeeper, GridRegion finalDestination, out string reason); bool LoginAgentToGrid(AgentCircuitData agent, GridRegion gatekeeper, GridRegion finalDestination, out string reason);
void SetClientToken(UUID sessionID, string token);
void LogoutAgent(UUID userID, UUID sessionID); void LogoutAgent(UUID userID, UUID sessionID);
GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt); GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt);
bool AgentIsComingHome(UUID sessionID, string thisGridExternalName); bool AgentIsComingHome(UUID sessionID, string thisGridExternalName);
bool VerifyAgent(UUID sessionID, string token); bool VerifyAgent(UUID sessionID, string token);
bool VerifyClient(UUID sessionID, string token); bool VerifyClient(UUID sessionID, string reportedIP);
} }
} }

View File

@ -761,12 +761,8 @@ namespace OpenSim.Services.LLLoginService
private bool LaunchAgentIndirectly(GridRegion gatekeeper, GridRegion destination, AgentCircuitData aCircuit, IPEndPoint clientIP, out string reason) private bool LaunchAgentIndirectly(GridRegion gatekeeper, GridRegion destination, AgentCircuitData aCircuit, IPEndPoint clientIP, out string reason)
{ {
m_log.Debug("[LLOGIN SERVICE] Launching agent at " + destination.RegionName); m_log.Debug("[LLOGIN SERVICE] Launching agent at " + destination.RegionName);
if (m_UserAgentService.LoginAgentToGrid(aCircuit, gatekeeper, destination, out reason)) if (m_UserAgentService.LoginAgentToGrid(aCircuit, gatekeeper, destination, clientIP, out reason))
{
IPAddress addr = NetworkUtil.GetExternalIPOf(clientIP.Address);
m_UserAgentService.SetClientToken(aCircuit.SessionID, addr.ToString() /* clientIP.Address.ToString() */);
return true; return true;
}
return false; return false;
} }

View File

@ -46,6 +46,7 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.Authentication;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts; using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenSim.Tests.Common.Mock; using OpenSim.Tests.Common.Mock;
@ -63,6 +64,7 @@ namespace OpenSim.Tests.Common.Setup
private static ISharedRegionModule m_inventoryService = null; private static ISharedRegionModule m_inventoryService = null;
private static ISharedRegionModule m_gridService = null; private static ISharedRegionModule m_gridService = null;
private static ISharedRegionModule m_userAccountService = null; private static ISharedRegionModule m_userAccountService = null;
private static ISharedRegionModule m_presenceService = null;
/// <summary> /// <summary>
/// Set up a test scene /// Set up a test scene
@ -180,7 +182,7 @@ namespace OpenSim.Tests.Common.Setup
else else
StartAssetService(testScene, false); StartAssetService(testScene, false);
// For now, always started a 'real' authenication service // For now, always started a 'real' authentication service
StartAuthenticationService(testScene, true); StartAuthenticationService(testScene, true);
if (realServices.Contains("inventory")) if (realServices.Contains("inventory"))
@ -188,10 +190,9 @@ namespace OpenSim.Tests.Common.Setup
else else
StartInventoryService(testScene, false); StartInventoryService(testScene, false);
if (realServices.Contains("grid"))
StartGridService(testScene, true); StartGridService(testScene, true);
StartUserAccountService(testScene); StartUserAccountService(testScene);
StartPresenceService(testScene);
} }
// If not, make sure the shared module gets references to this new scene // If not, make sure the shared module gets references to this new scene
else else
@ -202,11 +203,15 @@ namespace OpenSim.Tests.Common.Setup
m_inventoryService.RegionLoaded(testScene); m_inventoryService.RegionLoaded(testScene);
m_userAccountService.AddRegion(testScene); m_userAccountService.AddRegion(testScene);
m_userAccountService.RegionLoaded(testScene); m_userAccountService.RegionLoaded(testScene);
m_presenceService.AddRegion(testScene);
m_presenceService.RegionLoaded(testScene);
} }
m_inventoryService.PostInitialise(); m_inventoryService.PostInitialise();
m_assetService.PostInitialise(); m_assetService.PostInitialise();
m_userAccountService.PostInitialise(); m_userAccountService.PostInitialise();
m_presenceService.PostInitialise();
testScene.RegionInfo.EstateSettings.EstateOwner = UUID.Random(); testScene.RegionInfo.EstateSettings.EstateOwner = UUID.Random();
testScene.SetModuleInterfaces(); testScene.SetModuleInterfaces();
@ -225,6 +230,10 @@ namespace OpenSim.Tests.Common.Setup
m_inventoryService = null; m_inventoryService = null;
m_gridService = null; m_gridService = null;
m_userAccountService = null; m_userAccountService = null;
m_presenceService = null;
testScene.RegionInfo.EstateSettings = new EstateSettings();
testScene.LoginsDisabled = false;
return testScene; return testScene;
} }
@ -336,6 +345,32 @@ namespace OpenSim.Tests.Common.Setup
testScene.AddRegionModule(m_userAccountService.Name, m_userAccountService); testScene.AddRegionModule(m_userAccountService.Name, m_userAccountService);
} }
/// <summary>
/// Start a presence service
/// </summary>
/// <param name="testScene"></param>
private static void StartPresenceService(Scene testScene)
{
IConfigSource config = new IniConfigSource();
config.AddConfig("Modules");
config.AddConfig("PresenceService");
config.Configs["Modules"].Set("PresenceServices", "LocalPresenceServicesConnector");
config.Configs["PresenceService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
config.Configs["PresenceService"].Set(
"LocalServiceModule", "OpenSim.Services.PresenceService.dll:PresenceService");
if (m_presenceService == null)
{
ISharedRegionModule presenceService = new LocalPresenceServicesConnector();
presenceService.Initialise(config);
m_presenceService = presenceService;
}
m_presenceService.AddRegion(testScene);
m_presenceService.RegionLoaded(testScene);
testScene.AddRegionModule(m_presenceService.Name, m_presenceService);
}
/// <summary> /// <summary>
/// Setup modules for a scene using their default settings. /// Setup modules for a scene using their default settings.
/// </summary> /// </summary>
@ -446,9 +481,14 @@ namespace OpenSim.Tests.Common.Setup
{ {
string reason; string reason;
// We emulate the proper login sequence here by doing things in three stages // We emulate the proper login sequence here by doing things in four stages
// Stage 0: log the presence
scene.PresenceService.LoginAgent(agentData.AgentID.ToString(), agentData.SessionID, agentData.SecureSessionID);
// Stage 1: simulate login by telling the scene to expect a new user connection // Stage 1: simulate login by telling the scene to expect a new user connection
scene.NewUserConnection(agentData, (uint)TeleportFlags.ViaLogin, out reason); if (!scene.NewUserConnection(agentData, (uint)TeleportFlags.ViaLogin, out reason))
Console.WriteLine("NewUserConnection failed: " + reason);
// Stage 2: add the new client as a child agent to the scene // Stage 2: add the new client as a child agent to the scene
TestClient client = new TestClient(agentData, scene); TestClient client = new TestClient(agentData, scene);

View File

@ -300,7 +300,7 @@
; What is reported as the "X-Secondlife-Shard" ; What is reported as the "X-Secondlife-Shard"
; Defaults to the user server url if not set ; Defaults to the user server url if not set
; The old default is "OpenSim", set here fro compatibility ; The old default is "OpenSim", set here for compatibility
shard = "OpenSim" shard = "OpenSim"
; What is reported as the "User-Agent" when using llHTTPRequest ; What is reported as the "User-Agent" when using llHTTPRequest
@ -309,6 +309,18 @@
; " (Mozilla Compatible)" to the text where there are problems with a web server ; " (Mozilla Compatible)" to the text where there are problems with a web server
;user_agent = "OpenSim LSL (Mozilla Compatible)" ;user_agent = "OpenSim LSL (Mozilla Compatible)"
[XMLRPC]
; ##
; ## Scripting XMLRPC mapper
; ##
; If enabled, this will post an event, "xmlrpc_uri(string)" to the
; script concurrently with the first remote_data event.
; This will contain the fully qualified URI an external site needs
; to use to send XMLRPC requests to that script
;XmlRpcRouterModule = "XmlRpcRouterModule"
;XmlRpcPort = 20800
[ClientStack.LindenUDP] [ClientStack.LindenUDP]
; Set this to true to process incoming packets asynchronously. Networking is ; Set this to true to process incoming packets asynchronously. Networking is
@ -1180,37 +1192,38 @@ UseSafetyCommit = true
;vivox_channel_clamping_distance = 10 ;vivox_channel_clamping_distance = 10
[FreeSwitchVoice] [FreeSwitchVoice]
; In order for this to work you need a functioning freeswitch pbx set ; In order for this to work you need a functioning FreeSWITCH PBX set up.
; up. Configuration for that will be posted in the wiki soon. ; Configuration details at http://opensimulator.org/wiki/Freeswitch_Module
enabled = false enabled = false
;FreeSwitch server is going to contact us and ask us all ; FreeSWITCH server is going to contact us and ask us all sorts of things
;sorts of things.
freeswitch_server_user = freeswitch freeswitch_server_user = freeswitch
freeswitch_server_pass = password freeswitch_server_pass = password
freeswitch_api_prefix = /api freeswitch_api_prefix = /api
; this is the IP of your sim ; external IP address of your OpenSim voice enabled region
; note: all regions running on same OpenSim.exe will be enabled
freeswitch_service_server = ip.address.of.your.sim freeswitch_service_server = ip.address.of.your.sim
;freeswitch_service_port = 80
; this should be the same port the region listens on ; this should be the same port the region listens on
freeswitch_service_port = 9000 freeswitch_service_port = 9000
freeswitch_realm = ip.address.of.freeswitch.server freeswitch_realm = ip.address.of.freeswitch.server
freeswitch_sip_proxy = ip.address.of.freeswitch.server:5060 freeswitch_sip_proxy = ip.address.of.freeswitch.server:5060
; STUN = Simple Traversal of UDP through NATs
; See http://wiki.freeswitch.org/wiki/NAT_Traversal
; stun.freeswitch.org is not guaranteed to be running so use it in production at your own risk
freeswitch_attempt_stun = false freeswitch_attempt_stun = false
freeswitch_stun_server = ip.address.of.freeswitch.server freeswitch_stun_server = ip.address.of.stun.server
freeswitch_echo_server = ip.address.of.freeswitch.server freeswitch_echo_server = ip.address.of.freeswitch.server
freeswitch_echo_port = 50505 freeswitch_echo_port = 50505
freeswitch_well_known_ip = ip.address.of.freeswitch.server freeswitch_well_known_ip = ip.address.of.freeswitch.server
;
; Type the address of your http server here, hostname is allowed. This is provided so you can specify a hostname ; Type the address of your http server here, hostname is allowed. This is provided so you can specify a hostname
; This is used by client for account verification. By default, it's the same as the freeswitch service server. ; This is used by client for account verification. By default, it's the same as the freeswitch service server.
;
;opensim_well_known_http_address = Address_Of_your_SIM_HTTP_Server_Hostname_Allowed ; opensim_well_known_http_address = Address_Of_Your_SIM_HTTP_Server_Hostname_Allowed
;
freeswitch_default_timeout = 5000 freeswitch_default_timeout = 5000
freeswitch_subscribe_retry = 120 freeswitch_subscribe_retry = 120
; freeswitch_password_reset_url = ; freeswitch_password_reset_url =
[Groups] [Groups]
Enabled = false Enabled = false
@ -1331,16 +1344,8 @@ Message = "The MOTD module is working!"
[Modules] [Modules]
Include-modules = "addon-modules/*/config/*.ini" Include-modules = "addon-modules/*/config/*.ini"
[XMLRPC]
; ##
; ## Scripting XMLRPC mapper
; ##
; If enabled, this will post an event, "xmlrpc_uri(string)" to the
; script concurrently with the first remote_data event.
; This will contain the fully qualified URI an external site needs
; to use to send XMLRPC requests to that script
;XmlRpcRouterModule = "XmlRpcRouterModule"
;XmlRpcPort = 20800
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ENSURE [Architecture] and [Modules] Sections with their "includes"
;; are last to allow for overrides
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -1,15 +1,25 @@
;; Configurations for enabling HG1.5 ; * Run
;; ; * $ Robust.exe -inifile Robust.HG.ini
;; Run ; *
;; $ Robust.exe -inifile Robust.HG.ini
;; HG1.5 handlers are: OpenSim.Server.Handlers.dll:GatekeeperService
;; OpenSim.Server.Handlers.dll:UserAgentService
;; Additional OpenSim.Server.Handlers.dll:AssetServiceConnector and
;; OpenSim.Server.Handlers.dll:XInventoryInConnector
;; are started in port 8002, outside the firewall
;;
; * Configurations for enabling HG1.5
; *
; * HG1.5 handlers are: OpenSim.Server.Handlers.dll:GatekeeperService
; * OpenSim.Server.Handlers.dll:UserAgentService
; * Additional OpenSim.Server.Handlers.dll:AssetServiceConnector and
; * OpenSim.Server.Handlers.dll:XInventoryInConnector
; * are started in port 8002, outside the firewall
; *
; * The startup section lists all the connectors to start up in this server
; * instance. This may be only one, or it may be the entire server suite.
; * Multiple connectors should be separated by commas.
; *
; * These are the IN connectors the server uses, the in connectors
; * read this config file and load the needed service and database connectors
; *
; * The full syntax of a connector string is:
; * [[<ConfigName>@]<port>/]<dll name>[:<class name>]
; *
[Startup] [Startup]
ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003/OpenSim.Server.Handlers.dll:XInventoryInConnector,8002/OpenSim.Server.Handlers.dll:FreeswitchServerConnector,8003/OpenSim.Server.Handlers.dll:GridServiceConnector,8002/OpenSim.Server.Handlers.dll:GridInfoServerInConnector,8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector,8002/OpenSim.Server.Handlers.dll:OpenIdServerConnector,8003/OpenSim.Server.Handlers.dll:AvatarServiceConnector,8002/OpenSim.Server.Handlers.dll:LLLoginServiceInConnector,8003/OpenSim.Server.Handlers.dll:PresenceServiceConnector,8003/OpenSim.Server.Handlers.dll:UserAccountServiceConnector,8003/OpenSim.Server.Handlers.dll:GridUserServiceConnector,8003/OpenSim.Server.Handlers.dll:FriendsServiceConnector,8002/OpenSim.Server.Handlers.dll:GatekeeperServiceInConnector,8002/OpenSim.Server.Handlers.dll:UserAgentServerConnector,HGInventoryService@8002/OpenSim.Server.Handlers.dll:XInventoryInConnector,8002/OpenSim.Server.Handlers.dll:AssetServiceConnector" ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003/OpenSim.Server.Handlers.dll:XInventoryInConnector,8002/OpenSim.Server.Handlers.dll:FreeswitchServerConnector,8003/OpenSim.Server.Handlers.dll:GridServiceConnector,8002/OpenSim.Server.Handlers.dll:GridInfoServerInConnector,8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector,8002/OpenSim.Server.Handlers.dll:OpenIdServerConnector,8003/OpenSim.Server.Handlers.dll:AvatarServiceConnector,8002/OpenSim.Server.Handlers.dll:LLLoginServiceInConnector,8003/OpenSim.Server.Handlers.dll:PresenceServiceConnector,8003/OpenSim.Server.Handlers.dll:UserAccountServiceConnector,8003/OpenSim.Server.Handlers.dll:GridUserServiceConnector,8003/OpenSim.Server.Handlers.dll:FriendsServiceConnector,8002/OpenSim.Server.Handlers.dll:GatekeeperServiceInConnector,8002/OpenSim.Server.Handlers.dll:UserAgentServerConnector,HGInventoryService@8002/OpenSim.Server.Handlers.dll:XInventoryInConnector,8002/OpenSim.Server.Handlers.dll:AssetServiceConnector"
@ -52,7 +62,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
; * ; *
[GridService] [GridService]
LocalServiceModule = "OpenSim.Services.GridService.dll:GridService" LocalServiceModule = "OpenSim.Services.GridService.dll:GridService"
Realm = "regions" ; Realm = "regions"
; AllowDuplicateNames = "True" ; AllowDuplicateNames = "True"
; Check4096 = "False" ; Check4096 = "False"
@ -70,12 +80,13 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
; * This is the new style authentication service. Currently, only MySQL ; * This is the new style authentication service. Currently, only MySQL
; * is implemented. "Realm" is the table that is used for user lookup. ; * is implemented. "Realm" is the table that is used for user lookup.
; * By setting it to "users", you can use the old style users table ; * It defaults to "useraccounts", which uses the new style.
; * as an authentication source. ; * Realm = "users" will use the legacy tables as an authentication source
; * ; *
[AuthenticationService] [AuthenticationService]
; for the server connector ; for the server connector
LocalServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService" LocalServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
; Realm = "useraccounts"
[OpenIdService] [OpenIdService]
; for the server connector ; for the server connector
@ -89,7 +100,9 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
[UserAccountService] [UserAccountService]
; for the server connector ; for the server connector
LocalServiceModule = "OpenSim.Services.UserAccountService.dll:UserAccountService" LocalServiceModule = "OpenSim.Services.UserAccountService.dll:UserAccountService"
;; These are for creating new accounts by the service ; Realm = "usersaccounts"
; These are for creating new accounts by the service
AuthenticationService = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService" AuthenticationService = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService" PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService"
GridService = "OpenSim.Services.GridService.dll:GridService" GridService = "OpenSim.Services.GridService.dll:GridService"
@ -161,32 +174,25 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
; login page: optional: if it exists it will be used to tell the client to use ; login page: optional: if it exists it will be used to tell the client to use
; this as splash page ; this as splash page
; currently unused
;welcome = http://127.0.0.1/welcome ;welcome = http://127.0.0.1/welcome
; helper uri: optional: if it exists if will be used to tell the client to use ; helper uri: optional: if it exists if will be used to tell the client to use
; this for all economy related things ; this for all economy related things
; currently unused
;economy = http://127.0.0.1:9000/ ;economy = http://127.0.0.1:9000/
; web page of grid: optional: page providing further information about your grid ; web page of grid: optional: page providing further information about your grid
; currently unused
;about = http://127.0.0.1/about/ ;about = http://127.0.0.1/about/
; account creation: optional: page providing further information about obtaining ; account creation: optional: page providing further information about obtaining
; a user account on your grid ; a user account on your grid
; currently unused
;register = http://127.0.0.1/register ;register = http://127.0.0.1/register
; help: optional: page providing further assistance for users of your grid ; help: optional: page providing further assistance for users of your grid
; currently unused
;help = http://127.0.0.1/help ;help = http://127.0.0.1/help
; password help: optional: page providing password assistance for users of your grid ; password help: optional: page providing password assistance for users of your grid
; currently unused
;password = http://127.0.0.1/password ;password = http://127.0.0.1/password
[GatekeeperService] [GatekeeperService]
LocalServiceModule = "OpenSim.Services.HypergridService.dll:GatekeeperService" LocalServiceModule = "OpenSim.Services.HypergridService.dll:GatekeeperService"
;; for the service ;; for the service
@ -211,12 +217,12 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
GridService = "OpenSim.Services.GridService.dll:GridService" GridService = "OpenSim.Services.GridService.dll:GridService"
GatekeeperService = "OpenSim.Services.HypergridService.dll:GatekeeperService" GatekeeperService = "OpenSim.Services.HypergridService.dll:GatekeeperService"
;; The interface that local users get when they are in other grids. ; * The interface that local users get when they are in other grids.
;; This restricts the inventory operations while in other grids. ; * This restricts the inventory operations while in other grids.
;; Still not completely safe, especially if users perform inventory operations ; * Still not completely safe, especially if users perform inventory operations
;; while in those grids. The more the user accesses his/her inventory, the more ; * while in those grids. The more the user accesses his/her inventory, the more
;; those simulators will know about the user's inventory. ; * those simulators will know about the user's inventory.
; *
[HGInventoryService] [HGInventoryService]
; For the InventoryServiceInConnector ; For the InventoryServiceInConnector
LocalServiceModule = "OpenSim.Services.InventoryService.dll:HGInventoryService" LocalServiceModule = "OpenSim.Services.InventoryService.dll:HGInventoryService"

View File

@ -1,16 +1,18 @@
; * Run
; * $ Robust.exe -inifile Robust.ini
; *
; * The startup section lists all the connectors to start up in this server ; * The startup section lists all the connectors to start up in this server
; * instance. This may be only one, or it may be the entire server suite. ; * instance. This may be only one, or it may be the entire server suite.
; * Multiple connectors should be seaprated by commas. ; * Multiple connectors should be separated by commas.
; * The startup section lists all the connectors to start up in this server
; * instance. This may be only one, or it may be the entire server suite.
; * Multiple connectors should be seaprated by commas.
; * ; *
; * These are the IN connectors the server uses, the in connectors ; * These are the IN connectors the server uses, the in connectors
; * read this config file and load the needed service and database connectors ; * read this config file and load the needed service and database connectors
; * ; *
; * The full syntax of a connector string is:
; * [[<ConfigName>@]<port>/]<dll name>[:<class name>]
; * ; *
[Startup] [Startup]
ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003/OpenSim.Server.Handlers.dll:XInventoryInConnector,8002/OpenSim.Server.Handlers.dll:FreeswitchServerConnector,8003/OpenSim.Server.Handlers.dll:GridServiceConnector,8002/OpenSim.Server.Handlers.dll:GridInfoServerInConnector,8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector,8002/OpenSim.Server.Handlers.dll:OpenIdServerConnector,8003/OpenSim.Server.Handlers.dll:AvatarServiceConnector,8002/OpenSim.Server.Handlers.dll:LLLoginServiceInConnector,8003/OpenSim.Server.Handlers.dll:PresenceServiceConnector,8003/OpenSim.Server.Handlers.dll:UserAccountServiceConnector,8003/OpenSim.Server.Handlers.dll:GridUserServiceConnector,8003/OpenSim.Server.Handlers.dll:FriendsServiceConnector" ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003/OpenSim.Server.Handlers.dll:XInventoryInConnector,8002/OpenSim.Server.Handlers.dll:FreeswitchServerConnector,8003/OpenSim.Server.Handlers.dll:GridServiceConnector,8002/OpenSim.Server.Handlers.dll:GridInfoServerInConnector,8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector,8002/OpenSim.Server.Handlers.dll:OpenIdServerConnector,8003/OpenSim.Server.Handlers.dll:AvatarServiceConnector,8002/OpenSim.Server.Handlers.dll:LLLoginServiceInConnector,8003/OpenSim.Server.Handlers.dll:PresenceServiceConnector,8003/OpenSim.Server.Handlers.dll:UserAccountServiceConnector,8003/OpenSim.Server.Handlers.dll:GridUserServiceConnector,8003/OpenSim.Server.Handlers.dll:FriendsServiceConnector"
; * This is common for all services, it's the network setup for the entire ; * This is common for all services, it's the network setup for the entire
@ -30,7 +32,6 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
StorageProvider = "OpenSim.Data.MySQL.dll" StorageProvider = "OpenSim.Data.MySQL.dll"
ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=*****;Old Guids=true;" ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=*****;Old Guids=true;"
; * As an example, the below configuration precisely mimicks the legacy ; * As an example, the below configuration precisely mimicks the legacy
; * asset server. It is read by the asset IN connector (defined above) ; * asset server. It is read by the asset IN connector (defined above)
; * and it then loads the OUT connector (a local database module). That, ; * and it then loads the OUT connector (a local database module). That,
@ -54,8 +55,10 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
; * ; *
[GridService] [GridService]
LocalServiceModule = "OpenSim.Services.GridService.dll:GridService" LocalServiceModule = "OpenSim.Services.GridService.dll:GridService"
Realm = "regions" ; Realm = "regions"
; AllowDuplicateNames = "True" ; AllowDuplicateNames = "True"
; Check4096 = "False"
;; Next, we can specify properties of regions, including default and fallback regions ;; Next, we can specify properties of regions, including default and fallback regions
;; The syntax is: Region_<RegionName> = "<flags>" ;; The syntax is: Region_<RegionName> = "<flags>"
;; or: Region_<RegionID> = "<flags>" ;; or: Region_<RegionID> = "<flags>"
@ -70,8 +73,8 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
; * This is the new style authentication service. Currently, only MySQL ; * This is the new style authentication service. Currently, only MySQL
; * is implemented. "Realm" is the table that is used for user lookup. ; * is implemented. "Realm" is the table that is used for user lookup.
; * By setting it to "users", you can use the old style users table ; * It defaults to "users", which uses the legacy tables as an
; * as an authentication source. ; * authentication source.
; * ; *
[AuthenticationService] [AuthenticationService]
; for the server connector ; for the server connector
@ -82,15 +85,17 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
AuthenticationServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService" AuthenticationServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
UserAccountServiceModule = "OpenSim.Services.UserAccountService.dll:UserAccountService" UserAccountServiceModule = "OpenSim.Services.UserAccountService.dll:UserAccountService"
; * This is the new style user service. ; * This is the new style authentication service. Currently, only MySQL
; * "Realm" is the table that is used for user lookup. ; * is implemented. "Realm" is the table that is used for user lookup.
; * It defaults to "users", which uses the legacy tables ; * It defaults to "useraccounts", which uses the new style.
; * Realm = "users" will use the legacy tables as an authentication source
; * ; *
[UserAccountService] [UserAccountService]
; for the server connector ; for the server connector
LocalServiceModule = "OpenSim.Services.UserAccountService.dll:UserAccountService" LocalServiceModule = "OpenSim.Services.UserAccountService.dll:UserAccountService"
; Realm = "useraccounts" ; Realm = "useraccounts"
;; These are for creating new accounts by the service
; These are for creating new accounts by the service
AuthenticationService = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService" AuthenticationService = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService" PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService"
GridService = "OpenSim.Services.GridService.dll:GridService" GridService = "OpenSim.Services.GridService.dll:GridService"
@ -158,27 +163,21 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
; login page: optional: if it exists it will be used to tell the client to use ; login page: optional: if it exists it will be used to tell the client to use
; this as splash page ; this as splash page
; currently unused
;welcome = http://127.0.0.1/welcome ;welcome = http://127.0.0.1/welcome
; helper uri: optional: if it exists if will be used to tell the client to use ; helper uri: optional: if it exists if will be used to tell the client to use
; this for all economy related things ; this for all economy related things
; currently unused
;economy = http://127.0.0.1:9000/ ;economy = http://127.0.0.1:9000/
; web page of grid: optional: page providing further information about your grid ; web page of grid: optional: page providing further information about your grid
; currently unused
;about = http://127.0.0.1/about/ ;about = http://127.0.0.1/about/
; account creation: optional: page providing further information about obtaining ; account creation: optional: page providing further information about obtaining
; a user account on your grid ; a user account on your grid
; currently unused
;register = http://127.0.0.1/register ;register = http://127.0.0.1/register
; help: optional: page providing further assistance for users of your grid ; help: optional: page providing further assistance for users of your grid
; currently unused
;help = http://127.0.0.1/help ;help = http://127.0.0.1/help
; password help: optional: page providing password assistance for users of your grid ; password help: optional: page providing password assistance for users of your grid
; currently unused
;password = http://127.0.0.1/password ;password = http://127.0.0.1/password