From 1955b797598d61548521c444ea8d3721fd5435ba Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 19 Aug 2010 18:55:30 -0700 Subject: [PATCH 01/12] Partial rewrite of client IP verification. Not completely finished yet, and untested. Committing to move to my other computer. --- OpenSim/Framework/Constants.cs | 4 +- .../Handlers/Simulation/AgentHandlers.cs | 20 +++++ .../Hypergrid/GatekeeperServiceConnector.cs | 44 ++++++++++ .../Hypergrid/UserAgentServiceConnector.cs | 7 ++ .../Simulation/SimulationServiceConnector.cs | 83 +++++++++++++------ .../HypergridService/UserAgentService.cs | 44 +++++++--- .../Services/Interfaces/IGatekeeperService.cs | 6 +- .../Services/LLLoginService/LLLoginService.cs | 6 +- 8 files changed, 167 insertions(+), 47 deletions(-) diff --git a/OpenSim/Framework/Constants.cs b/OpenSim/Framework/Constants.cs index 5757061efc..1b1aaf2bc4 100644 --- a/OpenSim/Framework/Constants.cs +++ b/OpenSim/Framework/Constants.cs @@ -83,7 +83,9 @@ namespace OpenSim.Framework /// Finished, Sim Changed FinishedViaNewSim = 1 << 28, /// Finished, Same Sim - FinishedViaSameSim = 1 << 29 + FinishedViaSameSim = 1 << 29, + /// Agent coming into the grid from another grid + ViaHGLogin = 1 << 30 } } diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index d261678159..392927a9c3 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -178,6 +178,8 @@ namespace OpenSim.Server.Handlers.Simulation resp["reason"] = OSD.FromString(reason); 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? responsedata["int_response_code"] = HttpStatusCode.OK; @@ -352,6 +354,24 @@ namespace OpenSim.Server.Handlers.Simulation { 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; + } } } diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index c426bba807..291dd730de 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs @@ -38,6 +38,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; using OpenMetaverse; using OpenMetaverse.Imaging; +using OpenMetaverse.StructuredData; using Nwc.XmlRpc; using log4net; @@ -268,5 +269,48 @@ namespace OpenSim.Services.Connectors.Hypergrid 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; + } + } + } + + } } diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index 69dff3cd4d..c1e594947e 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs @@ -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) { reason = String.Empty; diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 6244565c2d..2b96b96e30 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -77,8 +77,26 @@ namespace OpenSim.Services.Connectors.Simulation public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason) { + HttpWebRequest AgentCreateRequest = null; 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) { reason = "Destination is null"; @@ -101,7 +119,7 @@ namespace OpenSim.Services.Connectors.Simulation //Console.WriteLine(" >>> DoCreateChildAgentCall <<< " + uri); - HttpWebRequest AgentCreateRequest = (HttpWebRequest)WebRequest.Create(uri); + AgentCreateRequest = (HttpWebRequest)WebRequest.Create(uri); AgentCreateRequest.Method = "POST"; AgentCreateRequest.ContentType = "application/json"; AgentCreateRequest.Timeout = 10000; @@ -134,7 +152,7 @@ namespace OpenSim.Services.Connectors.Simulation AgentCreateRequest.ContentLength = buffer.Length; //Count bytes to send os = AgentCreateRequest.GetRequestStream(); os.Write(buffer, 0, strBuffer.Length); //Send it - m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: Posted CreateAgent request to remote sim {0}, region {1}, x={2} y={3}", + m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: Posted CreateAgent request to remote sim {0}, region {1}, x={2} y={3}", uri, destination.RegionName, destination.RegionLocX, destination.RegionLocY); } //catch (WebException ex) @@ -150,11 +168,18 @@ namespace OpenSim.Services.Connectors.Simulation os.Close(); } + return true; + } + + protected string GetResponse(HttpWebRequest AgentCreateRequest, out string reason) + { // Let's wait for the response //m_log.Info("[REMOTE SIMULATION CONNECTOR]: Waiting for a reply after DoCreateChildAgentCall"); + reason = string.Empty; WebResponse webResponse = null; StreamReader sr = null; + string response = string.Empty; try { webResponse = AgentCreateRequest.GetResponse(); @@ -166,37 +191,15 @@ namespace OpenSim.Services.Connectors.Simulation { 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); - - 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) { m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of DoCreateChildAgentCall {0}", ex.Message); reason = "Destination did not reply"; - return false; + return string.Empty; } finally { @@ -204,7 +207,33 @@ namespace OpenSim.Services.Connectors.Simulation 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) diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index 181d7f26d1..6b14e2115f 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs @@ -131,10 +131,11 @@ namespace OpenSim.Services.HypergridService 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}", - agentCircuit.firstname, agentCircuit.lastname, gatekeeper.ExternalHostName +":"+ gatekeeper.HttpPort); + m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}", + agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "(stored IP)" : clientIP.ToString()), + gatekeeper.ExternalHostName +":"+ gatekeeper.HttpPort); // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination 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 = false; + string myExternalIP = string.Empty; string gridName = "http://" + gatekeeper.ExternalHostName + ":" + gatekeeper.HttpPort; if (m_GridName == gridName) success = m_GatekeeperService.LoginAgent(agentCircuit, finalDestination, out reason); 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) { @@ -167,15 +169,25 @@ namespace OpenSim.Services.HypergridService return false; } + // else set the IP addresses associated with this client + if (clientIP != null) + m_TravelingAgents[agentCircuit.SessionID].ClientIPAddress = clientIP.ToString(); + m_TravelingAgents[agentCircuit.SessionID].MyIpAddress = myExternalIP; 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)) { - m_log.DebugFormat("[USER AGENT SERVICE]: Setting token {0} for session {1}", token, sessionID); - m_TravelingAgents[sessionID].ClientToken = token; + m_log.DebugFormat("[USER AGENT SERVICE]: Setting IP {0} for session {1}", ip, sessionID); + m_TravelingAgents[sessionID].ClientIPAddress = ip; } } @@ -196,7 +208,7 @@ namespace OpenSim.Services.HypergridService travel.GridExternalName = "http://" + region.ExternalHostName + ":" + region.HttpPort; travel.ServiceToken = agentCircuit.ServiceSessionID; if (old != null) - travel.ClientToken = old.ClientToken; + travel.ClientIPAddress = old.ClientIPAddress; return old; } @@ -233,15 +245,22 @@ namespace OpenSim.Services.HypergridService return travel.GridExternalName == thisGridExternalName; } - public bool VerifyClient(UUID sessionID, string token) + public bool VerifyClient(UUID sessionID, string reportedIP) { if (m_BypassClientVerification) 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)) - 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; } @@ -266,7 +285,8 @@ namespace OpenSim.Services.HypergridService public UUID UserID; public string GridExternalName = 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 } } diff --git a/OpenSim/Services/Interfaces/IGatekeeperService.cs b/OpenSim/Services/Interfaces/IGatekeeperService.cs index 2d397bc03d..aac82936b0 100644 --- a/OpenSim/Services/Interfaces/IGatekeeperService.cs +++ b/OpenSim/Services/Interfaces/IGatekeeperService.cs @@ -48,13 +48,15 @@ namespace OpenSim.Services.Interfaces /// 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); - void SetClientToken(UUID sessionID, string token); void LogoutAgent(UUID userID, UUID sessionID); GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt); bool AgentIsComingHome(UUID sessionID, string thisGridExternalName); bool VerifyAgent(UUID sessionID, string token); - bool VerifyClient(UUID sessionID, string token); + bool VerifyClient(UUID sessionID, string reportedIP); } } diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 4b7cb5d2c9..b74029787b 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -755,12 +755,8 @@ namespace OpenSim.Services.LLLoginService private bool LaunchAgentIndirectly(GridRegion gatekeeper, GridRegion destination, AgentCircuitData aCircuit, IPEndPoint clientIP, out string reason) { m_log.Debug("[LLOGIN SERVICE] Launching agent at " + destination.RegionName); - if (m_UserAgentService.LoginAgentToGrid(aCircuit, gatekeeper, destination, out reason)) - { - IPAddress addr = NetworkUtil.GetExternalIPOf(clientIP.Address); - m_UserAgentService.SetClientToken(aCircuit.SessionID, addr.ToString() /* clientIP.Address.ToString() */); + if (m_UserAgentService.LoginAgentToGrid(aCircuit, gatekeeper, destination, clientIP, out reason)) return true; - } return false; } From a39ea07158756a76757d4b616c60cbcedf06f268 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 19 Aug 2010 19:54:40 -0700 Subject: [PATCH 02/12] Finished implementing ViaLogin vs ViaHGLogin. Removed lookup on myipaddress.com. Also removed client IP verification upon UDP connection that had been left there -- we can't do that in general. --- OpenSim/Framework/NetworkUtil.cs | 82 ------------------- OpenSim/Region/Framework/Scenes/Scene.cs | 52 ++++++------ .../HypergridService/GatekeeperService.cs | 28 ++++--- .../HypergridService/UserAgentService.cs | 5 +- 4 files changed, 48 insertions(+), 119 deletions(-) diff --git a/OpenSim/Framework/NetworkUtil.cs b/OpenSim/Framework/NetworkUtil.cs index 831ff70e77..2e94b0d5b4 100644 --- a/OpenSim/Framework/NetworkUtil.cs +++ b/OpenSim/Framework/NetworkUtil.cs @@ -181,16 +181,8 @@ namespace OpenSim.Framework throw new ArgumentException("[NetworkUtil] Unable to resolve defaultHostname to an IPv4 address for an IPv4 client"); } - static IPAddress externalIPAddress; - static NetworkUtil() { - try - { - externalIPAddress = GetExternalIP(); - } - catch { /* ignore */ } - try { foreach (NetworkInterface ni in NetworkInterface.GetAllNetworkInterfaces()) @@ -254,79 +246,5 @@ namespace OpenSim.Framework 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 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; - } } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 18705a8121..e742b55145 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2507,26 +2507,26 @@ namespace OpenSim.Region.Framework.Scenes { AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); - // 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; - } - } + //// Do the verification here -- No, really don't do this here. This is UDP address, let it go. + //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); @@ -2555,16 +2555,14 @@ namespace OpenSim.Region.Framework.Scenes vialogin = false; // 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; IUserAgentVerificationModule userVerification = RequestModuleInterface(); if (userVerification != null && ep != null) { - System.Net.IPAddress addr = NetworkUtil.GetExternalIPOf(ep.Address); - - if (!userVerification.VerifyClient(aCircuit, /*ep.Address.ToString() */ addr.ToString())) + if (!userVerification.VerifyClient(aCircuit, ep.Address.ToString())) { // 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); @@ -2575,6 +2573,10 @@ 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); + return true; } diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 6f041dae21..3f5c4f1400 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -225,17 +225,23 @@ namespace OpenSim.Services.HypergridService // May want to authorize + bool isFirstLogin = false; // - // Login the presence + // Login the presence, if it's not there yet (by the login service) // - if (!m_PresenceService.LoginAgent(aCircuit.AgentID.ToString(), aCircuit.SessionID, aCircuit.SecureSessionID)) - { - reason = "Unable to login presence"; - m_log.InfoFormat("[GATEKEEPER SERVICE]: Presence login failed for foreign agent {0} {1}. Refusing service.", - aCircuit.firstname, aCircuit.lastname); - return false; - } - m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence ok"); + 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)) + { + reason = "Unable to login presence"; + m_log.InfoFormat("[GATEKEEPER SERVICE]: Presence login failed for foreign agent {0} {1}. Refusing service.", + aCircuit.firstname, aCircuit.lastname); + return false; + } + m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence ok"); // // Get the region @@ -274,7 +280,9 @@ namespace OpenSim.Services.HypergridService // // 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) diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index 6b14e2115f..8c3be7023b 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs @@ -134,7 +134,7 @@ namespace OpenSim.Services.HypergridService 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} (@{2}) to grid {3}", - agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "(stored IP)" : clientIP.ToString()), + 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 @@ -169,9 +169,10 @@ namespace OpenSim.Services.HypergridService 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.ToString(); + m_TravelingAgents[agentCircuit.SessionID].ClientIPAddress = clientIP.Address.ToString(); m_TravelingAgents[agentCircuit.SessionID].MyIpAddress = myExternalIP; return true; } From ae554a48d0cea61d05dc931c04f336d83de4834b Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 20 Aug 2010 08:36:23 +0100 Subject: [PATCH 03/12] Add some maptile options, change maptile generation from OpenSimBase to Scene to make it more configurable. --- OpenSim/Region/Application/OpenSimBase.cs | 8 --- OpenSim/Region/Framework/Scenes/Scene.cs | 63 +++++++++++++++++++---- bin/OpenSim.ini.example | 6 +++ 3 files changed, 60 insertions(+), 17 deletions(-) diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index eb18e83753..b80d17d74c 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -347,14 +347,6 @@ namespace OpenSim // Prims have to be loaded after module configuration since some modules may be invoked during the load scene.LoadPrimsFromStorage(regionInfo.originRegionID); - // moved these here as the map texture has to be created after the modules are initialized - // and has to happen before the region is registered with the grid. - IWorldMapModule mapModule = scene.RequestModuleInterface(); - if (mapModule != null) - mapModule.GenerateMaptile(); - else - m_log.WarnFormat("[STARTUP]: No map module available to generate map tile"); - // TODO : Try setting resource for region xstats here on scene MainServer.Instance.AddStreamHandler(new Region.Framework.Scenes.RegionStatsHandler(regionInfo)); diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 18705a8121..2890ecdfc6 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -396,6 +396,9 @@ namespace OpenSim.Region.Framework.Scenes private double m_rootReprioritizationDistance = 10.0; private double m_childReprioritizationDistance = 20.0; + private Timer m_mapGenerationTimer = new Timer(); + bool m_generateMaptiles = false; + #endregion #region Properties @@ -646,6 +649,29 @@ namespace OpenSim.Region.Framework.Scenes } m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); + + m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); + if (m_generateMaptiles) + { + int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); + if (maptileRefresh != 0) + { + m_mapGenerationTimer.Interval = maptileRefresh * 1000; + m_mapGenerationTimer.Elapsed += RegenerateMaptile; + m_mapGenerationTimer.AutoReset = true; + m_mapGenerationTimer.Start(); + } + } + else + { + string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString()); + UUID tileID; + + if (UUID.TryParse(tile, out tileID)) + { + RegionInfo.RegionSettings.TerrainImageID = tileID; + } + } } catch { @@ -1662,16 +1688,21 @@ namespace OpenSim.Region.Framework.Scenes m_sceneGridService.SetScene(this); - // These two 'commands' *must be* next to each other or sim rebooting fails. - //m_sceneGridService.RegisterRegion(m_interregionCommsOut, RegionInfo); - - GridRegion region = new GridRegion(RegionInfo); - string error = GridService.RegisterRegion(RegionInfo.ScopeID, region); - if (error != String.Empty) + // If we generate maptiles internally at all, the maptile generator + // will register the region. If not, do it here + if (m_generateMaptiles) { - throw new Exception(error); + RegenerateMaptile(null, null); + } + else + { + GridRegion region = new GridRegion(RegionInfo); + string error = GridService.RegisterRegion(RegionInfo.ScopeID, region); + if (error != String.Empty) + { + throw new Exception(error); + } } - } #endregion @@ -4878,5 +4909,19 @@ namespace OpenSim.Region.Framework.Scenes return offsets.ToArray(); } + + public void RegenerateMaptile(object sender, ElapsedEventArgs e) + { + IWorldMapModule mapModule = RequestModuleInterface(); + if (mapModule != null) + { + mapModule.GenerateMaptile(); + + string error = GridService.RegisterRegion(RegionInfo.ScopeID, new GridRegion(RegionInfo)); + + if (error != String.Empty) + throw new Exception(error); + } + } } -} \ No newline at end of file +} diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 3dc8f23a5e..1ac484505e 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -222,6 +222,12 @@ ;WorldMapModule = "WorldMap" ;MapImageModule = "MapImageModule" + ; Set to false to not generate any maptiles + ;GenerateMaptiles = "true" + ; Refreah (in seconds) the map tile periodically + ;MaptileRefresh = 0 + ; If not generating maptiles, use this static texture asset ID + ;MaptileStaticUUID = "00000000-0000-0000-0000-000000000000" ; ## ; ## EMAIL MODULE From 6f83b0ee4625ae6b94a7ca0525f7d8369da7e126 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 20 Aug 2010 09:02:05 -0700 Subject: [PATCH 04/12] Cleaned up a few more things related to incoming agents. --- OpenSim/Region/Framework/Scenes/Scene.cs | 91 ++++++++++++------------ 1 file changed, 44 insertions(+), 47 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 2f862ea290..a14762841d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2502,18 +2502,25 @@ namespace OpenSim.Region.Framework.Scenes /// public override void AddNewClient(IClientAPI client) { + AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); 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(); - SubscribeToClientEvents(client); ScenePresence presence; if (m_restorePresences.ContainsKey(client.AgentId)) { 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]; m_restorePresences.Remove(client.AgentId); @@ -2536,49 +2543,35 @@ namespace OpenSim.Region.Framework.Scenes } else { - AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); - - //// Do the verification here -- No, really don't do this here. This is UDP address, let it go. - //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); - - ScenePresence sp = CreateAndAddScenePresence(client); - if (aCircuit != null) - sp.Appearance = aCircuit.Appearance; - - // HERE!!! Do the initial attachments right here - // first agent upon login is a root agent by design. - // All other AddNewClient calls find aCircuit.child to be true - if (aCircuit == null || (aCircuit != null && aCircuit.child == false)) + if (GetScenePresence(client.AgentId) == null) // ensure there is no SP here { - sp.IsChildAgent = false; - Util.FireAndForget(delegate(object o) { sp.RezAttachments(); }); + m_log.Debug("[SCENE]: Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName); + + m_clientManager.Add(client); + SubscribeToClientEvents(client); + + ScenePresence sp = CreateAndAddScenePresence(client); + if (aCircuit != null) + sp.Appearance = aCircuit.Appearance; + + // HERE!!! Do the initial attachments right here + // first agent upon login is a root agent by design. + // All other AddNewClient calls find aCircuit.child to be true + if (aCircuit == null || (aCircuit != null && aCircuit.child == false)) + { + sp.IsChildAgent = false; + Util.FireAndForget(delegate(object o) { sp.RezAttachments(); }); + } } } - m_LastLogin = Util.EnvironmentTickCount(); - EventManager.TriggerOnNewClient(client); - if (vialogin) - EventManager.TriggerOnClientLogin(client); + if (GetScenePresence(client.AgentId) != null) + { + m_LastLogin = Util.EnvironmentTickCount(); + EventManager.TriggerOnNewClient(client); + if (vialogin) + EventManager.TriggerOnClientLogin(client); + } } private bool VerifyClient(AgentCircuitData aCircuit, System.Net.IPEndPoint ep, out bool vialogin) @@ -2605,8 +2598,11 @@ 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.", + { + 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; } @@ -3245,7 +3241,8 @@ namespace OpenSim.Region.Framework.Scenes /// also return a 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; //Teleport flags: @@ -3282,7 +3279,7 @@ namespace OpenSim.Region.Framework.Scenes ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); //On login test land permisions - if (tp == TeleportFlags.ViaLogin) + if (vialogin) { if (land != null && !TestLandRestrictions(agent, land, out reason)) { @@ -3341,7 +3338,7 @@ namespace OpenSim.Region.Framework.Scenes agent.teleportFlags = teleportFlags; m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); - if (tp == TeleportFlags.ViaLogin) + if (vialogin) { if (TestBorderCross(agent.startpos, Cardinals.E)) { @@ -3459,7 +3456,7 @@ namespace OpenSim.Region.Framework.Scenes IPresenceService presence = RequestModuleInterface(); 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; } @@ -3467,7 +3464,7 @@ namespace OpenSim.Region.Framework.Scenes 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; } From bb5dd9fbbc39d2023c29ecc9deecd06523c7e467 Mon Sep 17 00:00:00 2001 From: Marck Date: Tue, 17 Aug 2010 20:54:51 +0200 Subject: [PATCH 05/12] Some code cleanup for console command alert. Made parsing of parameters more robust. Allow general alerts without specifying keyword 'general'. Extended help texts. --- .../CoreModules/Avatar/Dialog/DialogModule.cs | 52 +++++++++++++++---- 1 file changed, 43 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs index 2105f3c44b..2b3d2a9b14 100644 --- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs @@ -51,10 +51,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog m_scene.RegisterModuleInterface(this); m_scene.AddCommand( - this, "alert", "alert ", "Send an alert to a user", HandleAlertConsoleCommand); + this, "alert", "alert ", + "Send an alert to a user", + HandleAlertConsoleCommand); m_scene.AddCommand( - this, "alert general", "alert general ", "Send an alert to everyone", HandleAlertConsoleCommand); + this, "alert general", "alert [general] ", + "Send an alert to everyone", + "If keyword 'general' is omitted, then must be surrounded by quotation marks.", + HandleAlertConsoleCommand); } public void PostInitialise() {} @@ -173,20 +178,49 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog if (m_scene.ConsoleScene() != null && m_scene.ConsoleScene() != m_scene) return; - if (cmdparams[1] == "general") + bool isGeneral = false; + string firstName = string.Empty; + string lastName = string.Empty; + string message = string.Empty; + + if (cmdparams.Length > 1) { - string message = CombineParams(cmdparams, 2); + firstName = cmdparams[1]; + isGeneral = firstName.ToLower().Equals("general"); + } + if (cmdparams.Length == 2 && !isGeneral) + { + // alert "message" + message = cmdparams[1]; + isGeneral = true; + } + else if (cmdparams.Length > 2 && isGeneral) + { + // alert general + message = CombineParams(cmdparams, 2); + } + else if (cmdparams.Length > 3) + { + // alert + lastName = cmdparams[2]; + message = CombineParams(cmdparams, 3); + } + else + { + OpenSim.Framework.Console.MainConsole.Instance.Output( + "Usage: alert \"message\" | alert general | alert "); + return; + } + if (isGeneral) + { m_log.InfoFormat( - "[DIALOG]: Sending general alert in region {0} with message {1}", m_scene.RegionInfo.RegionName, message); + "[DIALOG]: Sending general alert in region {0} with message {1}", + m_scene.RegionInfo.RegionName, message); SendGeneralAlert(message); } else { - string firstName = cmdparams[1]; - string lastName = cmdparams[2]; - string message = CombineParams(cmdparams, 3); - m_log.InfoFormat( "[DIALOG]: Sending alert in region {0} to {1} {2} with message {3}", m_scene.RegionInfo.RegionName, firstName, lastName, message); From 86a61696d714f92264528a51486c9dce7840a9bb Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 20 Aug 2010 17:58:02 +0100 Subject: [PATCH 06/12] minor: remove mono compiler warning --- .../InterGrid/OpenGridProtocolModule.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs index 87a0a8dd7b..fd0e879e05 100644 --- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs +++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs @@ -100,7 +100,7 @@ namespace OpenSim.Region.CoreModules.InterGrid bool enabled = false; IConfig cfg = null; IConfig httpcfg = null; - IConfig startupcfg = null; +// IConfig startupcfg = null; try { cfg = config.Configs["OpenGridProtocol"]; @@ -117,14 +117,14 @@ namespace OpenSim.Region.CoreModules.InterGrid { } - try - { - startupcfg = config.Configs["Startup"]; - } - catch (NullReferenceException) - { - - } +// try +// { +// startupcfg = config.Configs["Startup"]; +// } +// catch (NullReferenceException) +// { +// +// } // if (startupcfg != null) // { From 2c0ba8718ac638483461e7862bf487ed11d23a4a Mon Sep 17 00:00:00 2001 From: Ai Austin Date: Mon, 16 Aug 2010 15:44:54 +0100 Subject: [PATCH 07/12] Robust.ini.example and Robust.HG.ini.example default: corrected comment about realm for UserAccountService to state default is useraccount, and include default realm commented out in every case --- bin/Robust.HG.ini.example | 68 ++++++++++++++++++++++----------------- bin/Robust.ini.example | 25 +++++++------- 2 files changed, 53 insertions(+), 40 deletions(-) diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example index 15b4d39c1d..b68f65d22a 100644 --- a/bin/Robust.HG.ini.example +++ b/bin/Robust.HG.ini.example @@ -1,14 +1,24 @@ -;; Configurations for enabling HG1.5 -;; -;; 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 -;; +; * Run +; * $ Robust.exe -inifile Robust.HG.ini +; * +; * 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: +; * [[@]/][:] +; * [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" @@ -52,10 +62,10 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 ; * [GridService] LocalServiceModule = "OpenSim.Services.GridService.dll:GridService" - Realm = "regions" + ; Realm = "regions" ; AllowDuplicateNames = "True" ; Check4096 = "False" - + ;; Next, we can specify properties of regions, including default and fallback regions ;; The syntax is: Region_ = "" ;; or: Region_ = "" @@ -70,12 +80,13 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 ; * This is the new style authentication service. Currently, only MySQL ; * 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 -; * as an authentication source. +; * It defaults to "useraccounts", which uses the new style. +; * Realm = "users" will use the legacy tables as an authentication source ; * [AuthenticationService] ; for the server connector LocalServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService" + ; Realm = "useraccounts" [OpenIdService] ; for the server connector @@ -89,12 +100,12 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 [UserAccountService] ; for the server connector LocalServiceModule = "OpenSim.Services.UserAccountService.dll:UserAccountService" - ;; These are for creating new accounts by the service + ; Realm = "users" + ; These are for creating new accounts by the service AuthenticationService = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService" PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService" GridService = "OpenSim.Services.GridService.dll:GridService" InventoryService = "OpenSim.Services.InventoryService.dll:XInventoryService" - [GridUserService] ; for the server connector LocalServiceModule = "OpenSim.Services.UserAccountService.dll:GridUserService" @@ -131,7 +142,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 UserAgentService = "OpenSim.Services.HypergridService.dll:UserAgentService" FriendsService = "OpenSim.Services.FriendsService.dll:FriendsService" - WelcomeMessage = "Welcome, Avatar!" + WelcomeMessage = "Welcome to OpenSim!" AllowRemoteSetLoginLevel = "false" ; Defaults for the users, if none is specified in the useraccounts table entry (ServiceURLs) @@ -186,7 +197,6 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 ; currently unused ;password = http://127.0.0.1/password - [GatekeeperService] LocalServiceModule = "OpenSim.Services.HypergridService.dll:GatekeeperService" ;; for the service @@ -200,9 +210,9 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 ; CHANGE THIS ExternalName = "http://127.0.0.1:8002" - ; Does this grid allow incoming links to any region in it? - ; If false, HG TPs happen only to the Default regions specified in [GridService] section - AllowTeleportsToAnyRegion = true + ; Does this grid allow incoming links to any region in it? + ; If false, HG TPs happen only to the Default regions specified in [GridService] section + AllowTeleportsToAnyRegion = true [UserAgentService] LocalServiceModule = "OpenSim.Services.HypergridService.dll:UserAgentService" @@ -211,12 +221,12 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 GridService = "OpenSim.Services.GridService.dll:GridService" GatekeeperService = "OpenSim.Services.HypergridService.dll:GatekeeperService" -;; The interface that local users get when they are in other grids. -;; This restricts the inventory operations while in other grids. -;; Still not completely safe, especially if users perform inventory operations -;; while in those grids. The more the user accesses his/her inventory, the more -;; those simulators will know about the user's inventory. +; * The interface that local users get when they are in other grids. +; * This restricts the inventory operations while in other grids. +; * Still not completely safe, especially if users perform inventory operations +; * while in those grids. The more the user accesses his/her inventory, the more +; * those simulators will know about the user's inventory. +; * [HGInventoryService] ; For the InventoryServiceInConnector - LocalServiceModule = "OpenSim.Services.InventoryService.dll:HGInventoryService" - + LocalServiceModule = "OpenSim.Services.InventoryService.dll:HGInventoryService" diff --git a/bin/Robust.ini.example b/bin/Robust.ini.example index 96dfc01add..a940cc8ad7 100644 --- a/bin/Robust.ini.example +++ b/bin/Robust.ini.example @@ -1,14 +1,17 @@ +; * Run +; * $ Robust.exe -inifile Robust.ini +; * ; * 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. -; * 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. +; * 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: +; * [[@]/][:] ; * + [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" @@ -30,7 +33,6 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 StorageProvider = "OpenSim.Data.MySQL.dll" ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=*****;Old Guids=true;" - ; * As an example, the below configuration precisely mimicks the legacy ; * asset server. It is read by the asset IN connector (defined above) ; * and it then loads the OUT connector (a local database module). That, @@ -54,7 +56,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 ; * [GridService] LocalServiceModule = "OpenSim.Services.GridService.dll:GridService" - Realm = "regions" + ; Realm = "regions" ; AllowDuplicateNames = "True" ;; Next, we can specify properties of regions, including default and fallback regions ;; The syntax is: Region_ = "" @@ -70,8 +72,8 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 ; * This is the new style authentication service. Currently, only MySQL ; * 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 -; * as an authentication source. +; * It defaults to "users", which uses the legacy tables as an +; * authentication source. ; * [AuthenticationService] ; for the server connector @@ -82,9 +84,10 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 AuthenticationServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService" UserAccountServiceModule = "OpenSim.Services.UserAccountService.dll:UserAccountService" -; * 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 +; * This is the new style authentication service. Currently, only MySQL +; * is implemented. "Realm" is the table that is used for user lookup. +; * It defaults to "useraccounts", which uses the new style. +; * Realm = "users" will use the legacy tables as an authentication source ; * [UserAccountService] ; for the server connector From a87840bd1c60cc8b587245d89e77a52cd8eccf08 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 20 Aug 2010 18:25:44 +0100 Subject: [PATCH 08/12] Make some small corrections to ini.example file changes. These are not functional changes. --- bin/Robust.HG.ini.example | 16 ++++++---------- bin/Robust.ini.example | 16 ++++++---------- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example index b68f65d22a..122ba2e5f5 100644 --- a/bin/Robust.HG.ini.example +++ b/bin/Robust.HG.ini.example @@ -1,6 +1,7 @@ ; * Run ; * $ Robust.exe -inifile Robust.HG.ini ; * + ; * Configurations for enabling HG1.5 ; * ; * HG1.5 handlers are: OpenSim.Server.Handlers.dll:GatekeeperService @@ -17,9 +18,8 @@ ; * read this config file and load the needed service and database connectors ; * ; * The full syntax of a connector string is: -; * [[@]/][:] +; * [[@]/][:] ; * - [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" @@ -100,12 +100,14 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 [UserAccountService] ; for the server connector LocalServiceModule = "OpenSim.Services.UserAccountService.dll:UserAccountService" - ; Realm = "users" + ; Realm = "usersaccounts" + ; These are for creating new accounts by the service AuthenticationService = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService" PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService" GridService = "OpenSim.Services.GridService.dll:GridService" InventoryService = "OpenSim.Services.InventoryService.dll:XInventoryService" + [GridUserService] ; for the server connector LocalServiceModule = "OpenSim.Services.UserAccountService.dll:GridUserService" @@ -142,7 +144,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 UserAgentService = "OpenSim.Services.HypergridService.dll:UserAgentService" FriendsService = "OpenSim.Services.FriendsService.dll:FriendsService" - WelcomeMessage = "Welcome to OpenSim!" + WelcomeMessage = "Welcome, Avatar!" AllowRemoteSetLoginLevel = "false" ; Defaults for the users, if none is specified in the useraccounts table entry (ServiceURLs) @@ -172,29 +174,23 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 ; login page: optional: if it exists it will be used to tell the client to use ; this as splash page - ; currently unused ;welcome = http://127.0.0.1/welcome ; helper uri: optional: if it exists if will be used to tell the client to use ; this for all economy related things - ; currently unused ;economy = http://127.0.0.1:9000/ ; web page of grid: optional: page providing further information about your grid - ; currently unused ;about = http://127.0.0.1/about/ ; account creation: optional: page providing further information about obtaining ; a user account on your grid - ; currently unused ;register = http://127.0.0.1/register ; help: optional: page providing further assistance for users of your grid - ; currently unused ;help = http://127.0.0.1/help ; password help: optional: page providing password assistance for users of your grid - ; currently unused ;password = http://127.0.0.1/password [GatekeeperService] diff --git a/bin/Robust.ini.example b/bin/Robust.ini.example index a940cc8ad7..0353eec65c 100644 --- a/bin/Robust.ini.example +++ b/bin/Robust.ini.example @@ -1,6 +1,7 @@ ; * Run ; * $ Robust.exe -inifile Robust.ini ; * + ; * 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. @@ -9,11 +10,9 @@ ; * read this config file and load the needed service and database connectors ; * ; * The full syntax of a connector string is: -; * [[@]/][:] +; * [[@]/][:] ; * - [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" ; * This is common for all services, it's the network setup for the entire @@ -58,6 +57,8 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 LocalServiceModule = "OpenSim.Services.GridService.dll:GridService" ; Realm = "regions" ; AllowDuplicateNames = "True" + ; Check4096 = "False" + ;; Next, we can specify properties of regions, including default and fallback regions ;; The syntax is: Region_ = "" ;; or: Region_ = "" @@ -93,7 +94,8 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 ; for the server connector LocalServiceModule = "OpenSim.Services.UserAccountService.dll:UserAccountService" ; 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" PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService" GridService = "OpenSim.Services.GridService.dll:GridService" @@ -161,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 ; this as splash page - ; currently unused ;welcome = http://127.0.0.1/welcome ; helper uri: optional: if it exists if will be used to tell the client to use ; this for all economy related things - ; currently unused ;economy = http://127.0.0.1:9000/ ; web page of grid: optional: page providing further information about your grid - ; currently unused ;about = http://127.0.0.1/about/ ; account creation: optional: page providing further information about obtaining ; a user account on your grid - ; currently unused ;register = http://127.0.0.1/register ; help: optional: page providing further assistance for users of your grid - ; currently unused ;help = http://127.0.0.1/help ; password help: optional: page providing password assistance for users of your grid - ; currently unused ;password = http://127.0.0.1/password From c41ff51bd3d6806ada2f1e0852bb37b0092b1f25 Mon Sep 17 00:00:00 2001 From: Ai Austin Date: Mon, 16 Aug 2010 15:19:20 +0100 Subject: [PATCH 09/12] OpenSim.ini.example FreeSwitch section improvements, move of XML-RPC section away from end and correction of typo "fro" (fixes Mantis 4833) --- bin/OpenSim.ini.example | 59 ++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 1ac484505e..1ae9f9af7f 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -297,7 +297,7 @@ ; What is reported as the "X-Secondlife-Shard" ; 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" ; What is reported as the "User-Agent" when using llHTTPRequest @@ -306,6 +306,18 @@ ; " (Mozilla Compatible)" to the text where there are problems with a web server ;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] ; Set this to true to process incoming packets asynchronously. Networking is @@ -1161,37 +1173,38 @@ ;vivox_channel_clamping_distance = 10 [FreeSwitchVoice] - ; In order for this to work you need a functioning freeswitch pbx set - ; up. Configuration for that will be posted in the wiki soon. + ; In order for this to work you need a functioning FreeSWITCH PBX set up. + ; Configuration details at http://opensimulator.org/wiki/Freeswitch_Module enabled = false - ;FreeSwitch server is going to contact us and ask us all - ;sorts of things. + ; FreeSWITCH server is going to contact us and ask us all sorts of things freeswitch_server_user = freeswitch freeswitch_server_pass = password 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_port = 80 ; this should be the same port the region listens on freeswitch_service_port = 9000 freeswitch_realm = ip.address.of.freeswitch.server 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_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_port = 50505 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 - ;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 - + ; + ; 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. + ; + ; opensim_well_known_http_address = Address_Of_Your_SIM_HTTP_Server_Hostname_Allowed + ; freeswitch_default_timeout = 5000 freeswitch_subscribe_retry = 120 ; freeswitch_password_reset_url = - [Groups] Enabled = false @@ -1305,16 +1318,8 @@ [Modules] 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 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; From f347d25675dbe84345d4b1bfbad041303c75e293 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 20 Aug 2010 11:09:02 -0700 Subject: [PATCH 10/12] Unit test breakage fix. --- OpenSim/Framework/Capabilities/Caps.cs | 4 +- .../Framework/Capabilities/CapsHandlers.cs | 2 +- .../Agent/Capabilities/CapabilitiesModule.cs | 6 +- .../Scenes/Tests/SceneObjectBasicTests.cs | 8 +-- .../Scenes/Tests/ScenePresenceTests.cs | 9 ++- .../Tests/Common/Setup/SceneSetupHelpers.cs | 56 ++++++++++++++++--- 6 files changed, 65 insertions(+), 20 deletions(-) diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs index da953bbef0..0db7bb970f 100644 --- a/OpenSim/Framework/Capabilities/Caps.cs +++ b/OpenSim/Framework/Capabilities/Caps.cs @@ -142,7 +142,7 @@ namespace OpenSim.Framework.Capabilities m_httpListenPort = httpPort; - if (httpServer.UseSSL) + if (httpServer != null && httpServer.UseSSL) { m_httpListenPort = httpServer.SSLPort; httpListen = httpServer.SSLCommonName; @@ -151,7 +151,7 @@ namespace OpenSim.Framework.Capabilities m_agentID = agent; 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; } diff --git a/OpenSim/Framework/Capabilities/CapsHandlers.cs b/OpenSim/Framework/Capabilities/CapsHandlers.cs index f000aed3c2..864e6ddb7e 100644 --- a/OpenSim/Framework/Capabilities/CapsHandlers.cs +++ b/OpenSim/Framework/Capabilities/CapsHandlers.cs @@ -74,7 +74,7 @@ namespace OpenSim.Framework.Capabilities m_httpListenerHostName = httpListenerHostname; m_httpListenerPort = httpListenerPort; m_useSSL = https; - if (m_useSSL) + if (httpListener != null && m_useSSL) { m_httpListenerHostName = httpListener.SSLCommonName; m_httpListenerPort = httpListener.SSLPort; diff --git a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs index a6f5d97ad2..c023a6f738 100644 --- a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs +++ b/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs @@ -109,9 +109,9 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities Caps caps = new Caps(m_scene, 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); - + caps.RegisterHandlers(); m_scene.EventManager.TriggerOnRegisterCaps(agentId, caps); @@ -121,7 +121,7 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities caps.TaskScriptUpdatedCall = m_scene.CapsUpdateTaskInventoryScriptAsset; caps.CAPSFetchInventoryDescendents = m_scene.HandleFetchInventoryDescendentsCAPS; caps.GetClient = m_scene.SceneContents.GetControllingClient; - + m_capsHandlers[agentId] = caps; } diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs index d4f9f1876d..54b32601b9 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs @@ -130,11 +130,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests { TestHelper.InMethod(); //log4net.Config.XmlConfigurator.Configure(); - + UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); - + TestScene scene = SceneSetupHelpers.SetupScene(); - + // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; sogd.Enabled = false; @@ -147,7 +147,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); Assert.That(retrievedPart, Is.Not.Null); - + sogd.InventoryDeQueueAndDelete(); SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(part.LocalId); diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs index 501207e041..e39a362883 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs @@ -104,8 +104,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests agent.AgentID = agent1; agent.firstname = firstName; agent.lastname = "testlastname"; - agent.SessionID = UUID.Zero; - agent.SecureSessionID = UUID.Zero; + agent.SessionID = UUID.Random(); + agent.SecureSessionID = UUID.Random(); agent.circuitcode = 123; agent.BaseFolder = UUID.Zero; agent.InventoryFolder = UUID.Zero; @@ -114,6 +114,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests agent.ChildrenCapSeeds = new Dictionary(); 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; scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason); testclient = new TestClient(agent, scene); diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index 4a356e2943..eaa0d33b4b 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -46,6 +46,7 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.Authentication; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid; using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts; +using OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence; using OpenSim.Services.Interfaces; using OpenSim.Tests.Common.Mock; @@ -63,6 +64,7 @@ namespace OpenSim.Tests.Common.Setup private static ISharedRegionModule m_inventoryService = null; private static ISharedRegionModule m_gridService = null; private static ISharedRegionModule m_userAccountService = null; + private static ISharedRegionModule m_presenceService = null; /// /// Set up a test scene @@ -180,7 +182,7 @@ namespace OpenSim.Tests.Common.Setup else StartAssetService(testScene, false); - // For now, always started a 'real' authenication service + // For now, always started a 'real' authentication service StartAuthenticationService(testScene, true); if (realServices.Contains("inventory")) @@ -188,10 +190,9 @@ namespace OpenSim.Tests.Common.Setup else StartInventoryService(testScene, false); - if (realServices.Contains("grid")) - StartGridService(testScene, true); - + StartGridService(testScene, true); StartUserAccountService(testScene); + StartPresenceService(testScene); } // If not, make sure the shared module gets references to this new scene else @@ -202,11 +203,15 @@ namespace OpenSim.Tests.Common.Setup m_inventoryService.RegionLoaded(testScene); m_userAccountService.AddRegion(testScene); m_userAccountService.RegionLoaded(testScene); + m_presenceService.AddRegion(testScene); + m_presenceService.RegionLoaded(testScene); + } m_inventoryService.PostInitialise(); m_assetService.PostInitialise(); m_userAccountService.PostInitialise(); + m_presenceService.PostInitialise(); testScene.RegionInfo.EstateSettings.EstateOwner = UUID.Random(); testScene.SetModuleInterfaces(); @@ -225,7 +230,11 @@ namespace OpenSim.Tests.Common.Setup m_inventoryService = null; m_gridService = null; m_userAccountService = null; - + m_presenceService = null; + + testScene.RegionInfo.EstateSettings = new EstateSettings(); + testScene.LoginsDisabled = false; + return testScene; } @@ -336,6 +345,32 @@ namespace OpenSim.Tests.Common.Setup testScene.AddRegionModule(m_userAccountService.Name, m_userAccountService); } + /// + /// Start a presence service + /// + /// + 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); + } + /// /// Setup modules for a scene using their default settings. /// @@ -446,9 +481,14 @@ namespace OpenSim.Tests.Common.Setup { 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 - 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 TestClient client = new TestClient(agentData, scene); @@ -459,7 +499,7 @@ namespace OpenSim.Tests.Common.Setup //scene.AgentCrossing(agentData.AgentID, new Vector3(90, 90, 90), false); OBSOLETE ScenePresence scp = scene.GetScenePresence(agentData.AgentID); - scp.MakeRootAgent(new Vector3(90,90,90), true); + scp.MakeRootAgent(new Vector3(90, 90, 90), true); return client; } From 7aad5af49850b3938282426dd1ecf160d7053032 Mon Sep 17 00:00:00 2001 From: Marck Date: Sat, 14 Aug 2010 12:46:17 +0200 Subject: [PATCH 11/12] Some code cleanup for console command "create region". Make region name an optional command parameter. Avoid question for region name if it has already been specified. Extend help text. --- OpenSim/Framework/RegionInfo.cs | 2 +- OpenSim/Region/Application/OpenSim.cs | 65 ++++++++++++++------------- 2 files changed, 36 insertions(+), 31 deletions(-) diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index afc4060044..ea1a5949a6 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -393,7 +393,7 @@ namespace OpenSim.Framework if (!File.Exists(filename)) // New region config request { IniConfigSource newFile = new IniConfigSource(); - ReadNiniConfig(newFile, String.Empty); + ReadNiniConfig(newFile, configName); newFile.Save(filename); diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index d9ec287076..683460682f 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -308,8 +308,13 @@ namespace OpenSim "Persist objects to the database now", RunCommand); m_console.Commands.AddCommand("region", false, "create region", - "create region", - "Create a new region", HandleCreateRegion); + "create region [\"region name\"] ", + "Create a new region.", + "The settings for \"region name\" are read from ." + + " If \"region name\" does not exist in , it will be added." + Environment.NewLine + + "Without \"region name\", the first region found in will be created." + Environment.NewLine + + "If does not exist, it will be created.", + HandleCreateRegion); m_console.Commands.AddCommand("region", false, "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 /// /// - /// 0,1,region name, region XML file + /// 0,1,region name, region ini or XML file 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 "); + 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\"] "); return; } - if (cmd[3].EndsWith(".xml")) + if (!Path.IsPathRooted(regionFile)) { 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 = new RegionInfo(cmd[2], regionFile, false, ConfigSource.Source); - PopulateRegionEstateInfo(regInfo); - CreateRegion(regInfo, true, out scene); - regInfo.EstateSettings.Save(); + regionFile = Path.Combine(regionsDir, regionFile); } - 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 = new RegionInfo(cmd[2], regionFile, false, ConfigSource.Source, cmd[2]); - PopulateRegionEstateInfo(regInfo); - CreateRegion(regInfo, true, out scene); - regInfo.EstateSettings.Save(); + RegionInfo regInfo; + if (isXml) + { + regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source); } else { - MainConsole.Instance.Output("Usage: create region "); - return; + regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source, regionName); } + IScene scene; + PopulateRegionEstateInfo(regInfo); + CreateRegion(regInfo, true, out scene); + regInfo.EstateSettings.Save(); } /// From ea1df09fa4cc0c3322b147651f5d8ac3fefce55e Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 21 Aug 2010 00:46:16 +0200 Subject: [PATCH 12/12] Forward-port a small improvement to the land out connector --- .../ServiceConnectorsOut/Land/RemoteLandServiceConnector.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/RemoteLandServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/RemoteLandServiceConnector.cs index 23860600f9..252d9e7286 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/RemoteLandServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/RemoteLandServiceConnector.cs @@ -102,7 +102,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land public void RegionLoaded(Scene scene) { - m_GridService = scene.GridService; + if (m_Enabled) + m_GridService = scene.GridService; }