From 6772c9d2b6d05c985174f514aa8df2aacd33a201 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 18 Jan 2010 17:35:49 +0000 Subject: Comment the asset deletion handler. It can be abused and is not currently needed. --- OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server/Handlers') diff --git a/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs index 3f33da6..f33bb90 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs @@ -63,7 +63,7 @@ namespace OpenSim.Server.Handlers.Asset if (p.Length > 0) { - result = m_AssetService.Delete(p[0]); + // result = m_AssetService.Delete(p[0]); } XmlSerializer xs = new XmlSerializer(typeof(bool)); -- cgit v1.1 From 65775b87e5000a07634240ab8ce39aaecd30d1e6 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 5 May 2010 23:06:36 +0200 Subject: Add a XMLRPC method to remotely set the login level for the LLLoginService. This requires a special XMLRPC call, which has to supply the credentials of a god user (User level >= 200). Disabled by default. Also Adds a configuration option to set the initial permitted login level. --- OpenSim/Server/Handlers/Login/LLLoginHandlers.cs | 37 ++++++++++++++++++++++ .../Handlers/Login/LLLoginServiceInConnector.cs | 1 + 2 files changed, 38 insertions(+) (limited to 'OpenSim/Server/Handlers') diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs index daf2704..83b3e31 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs @@ -99,6 +99,43 @@ namespace OpenSim.Server.Handlers.Login } + public XmlRpcResponse HandleXMLRPCSetLoginLevel(XmlRpcRequest request, IPEndPoint remoteClient) + { + Hashtable requestData = (Hashtable)request.Params[0]; + + if (requestData != null) + { + if (requestData.ContainsKey("first") && requestData["first"] != null && + requestData.ContainsKey("last") && requestData["last"] != null && + requestData.ContainsKey("level") && requestData["level"] != null && + requestData.ContainsKey("passwd") && requestData["passwd"] != null) + { + string first = requestData["first"].ToString(); + string last = requestData["last"].ToString(); + string passwd = requestData["passwd"].ToString(); + int level = Int32.Parse(requestData["level"].ToString()); + + m_log.InfoFormat("[LOGIN]: XMLRPC Set Level to {2} Requested by {0} {1}", first, last, level); + + Hashtable reply = m_LocalService.SetLevel(first, last, passwd, level, remoteClient); + + XmlRpcResponse response = new XmlRpcResponse(); + response.Value = reply; + + return response; + + } + } + + XmlRpcResponse failResponse = new XmlRpcResponse(); + Hashtable failHash = new Hashtable(); + failHash["success"] = "false"; + failResponse.Value = failHash; + + return failResponse; + + } + public OSD HandleLLSDLogin(OSD request, IPEndPoint remoteClient) { if (request.Type == OSDType.Map) diff --git a/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs b/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs index e24055b..67e8392 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs @@ -88,6 +88,7 @@ namespace OpenSim.Server.Handlers.Login { LLLoginHandlers loginHandlers = new LLLoginHandlers(m_LoginService); server.AddXmlRPCHandler("login_to_simulator", loginHandlers.HandleXMLRPCLogin, false); + server.AddXmlRPCHandler("set_login_level", loginHandlers.HandleXMLRPCSetLoginLevel, false); server.SetDefaultLLSDHandler(loginHandlers.HandleLLSDLogin); } -- cgit v1.1 From 733a07e061cdcb6095677758a264ba976bb94b93 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 6 May 2010 00:34:49 +0200 Subject: Plumb the viewer version string through into AgentCircuitData. Now all that is left os to figure out what black magic turns AgentCircuitData into AgentData and then copy that into the ScenePresence, where m_Viewer is already added with this commit and waits for the data. --- OpenSim/Server/Handlers/Login/LLLoginHandlers.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server/Handlers') diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs index 83b3e31..c9bf996 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs @@ -86,7 +86,7 @@ namespace OpenSim.Server.Handlers.Login m_log.InfoFormat("[LOGIN]: XMLRPC Login Requested for {0} {1}, starting in {2}, using {3}", first, last, startLocation, clientVersion); LoginResponse reply = null; - reply = m_LocalService.Login(first, last, passwd, startLocation, scopeID, remoteClient); + reply = m_LocalService.Login(first, last, passwd, startLocation, scopeID, clientVersion, remoteClient); XmlRpcResponse response = new XmlRpcResponse(); response.Value = reply.ToHashtable(); @@ -157,7 +157,7 @@ namespace OpenSim.Server.Handlers.Login m_log.Info("[LOGIN]: LLSD Login Requested for: '" + map["first"].AsString() + "' '" + map["last"].AsString() + "' / " + startLocation); LoginResponse reply = null; - reply = m_LocalService.Login(map["first"].AsString(), map["last"].AsString(), map["passwd"].AsString(), startLocation, scopeID, remoteClient); + reply = m_LocalService.Login(map["first"].AsString(), map["last"].AsString(), map["passwd"].AsString(), startLocation, scopeID, String.Empty, remoteClient); return reply.ToOSDMap(); } -- cgit v1.1 From 1c040d8c1ed5ee1ba1e80aa1d248a9b06d1790a5 Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Tue, 18 May 2010 03:24:43 -0700 Subject: Fix to the scenario where we send an agent to a neighbouring sim (via teleport), then tell our neighbours to close the agents.. thereby disconnecting the user. Added a new CloseChildAgent method in lieu of CloseAgent. This has been a long standing problem - with any luck this will cure it. --- .../Server/Handlers/Simulation/AgentHandlers.cs | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'OpenSim/Server/Handlers') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index ab3250d..b648e12 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -108,6 +108,11 @@ namespace OpenSim.Server.Handlers.Simulation DoAgentDelete(request, responsedata, agentID, action, regionID); return responsedata; } + else if (method.Equals("DELETECHILD")) + { + DoChildAgentDelete(request, responsedata, agentID, action, regionID); + return responsedata; + } else { m_log.InfoFormat("[AGENT HANDLER]: method {0} not supported in agent message", method); @@ -320,6 +325,24 @@ namespace OpenSim.Server.Handlers.Simulation } } + protected void DoChildAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, UUID regionID) + { + m_log.Debug(" >>> DoChildAgentDelete action:" + action + "; RegionID:" + regionID); + + GridRegion destination = new GridRegion(); + destination.RegionID = regionID; + + if (action.Equals("release")) + ReleaseAgent(regionID, id); + else + m_SimulationService.CloseChildAgent(destination, id); + + responsedata["int_response_code"] = HttpStatusCode.OK; + responsedata["str_response_string"] = "OpenSim agent " + id.ToString(); + + m_log.Debug("[AGENT HANDLER]: Child Agent Released/Deleted."); + } + protected void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, UUID regionID) { m_log.Debug(" >>> DoDelete action:" + action + "; RegionID:" + regionID); -- cgit v1.1 From ac5373427f99d259a55147e097a8a76050a60db6 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 27 May 2010 20:08:12 +0200 Subject: Comment noisy "CONNECTION DEBUGGING" messages, because they push more important stuff off screen too fast. Clean this time --- OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs | 14 +++++++------- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'OpenSim/Server/Handlers') diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs index 17d7850..e50481a 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs @@ -61,13 +61,13 @@ namespace OpenSim.Server.Handlers.Hypergrid public Hashtable Handler(Hashtable request) { - m_log.Debug("[CONNECTION DEBUGGING]: HomeAgentHandler Called"); - - m_log.Debug("---------------------------"); - m_log.Debug(" >> uri=" + request["uri"]); - m_log.Debug(" >> content-type=" + request["content-type"]); - m_log.Debug(" >> http-method=" + request["http-method"]); - m_log.Debug("---------------------------\n"); +// m_log.Debug("[CONNECTION DEBUGGING]: HomeAgentHandler Called"); +// +// m_log.Debug("---------------------------"); +// m_log.Debug(" >> uri=" + request["uri"]); +// m_log.Debug(" >> content-type=" + request["content-type"]); +// m_log.Debug(" >> http-method=" + request["http-method"]); +// m_log.Debug("---------------------------\n"); Hashtable responsedata = new Hashtable(); responsedata["content_type"] = "text/html"; diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index b648e12..c4117f5 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -61,13 +61,13 @@ namespace OpenSim.Server.Handlers.Simulation public Hashtable Handler(Hashtable request) { - m_log.Debug("[CONNECTION DEBUGGING]: AgentHandler Called"); - - m_log.Debug("---------------------------"); - m_log.Debug(" >> uri=" + request["uri"]); - m_log.Debug(" >> content-type=" + request["content-type"]); - m_log.Debug(" >> http-method=" + request["http-method"]); - m_log.Debug("---------------------------\n"); +// m_log.Debug("[CONNECTION DEBUGGING]: AgentHandler Called"); +// +// m_log.Debug("---------------------------"); +// m_log.Debug(" >> uri=" + request["uri"]); +// m_log.Debug(" >> content-type=" + request["content-type"]); +// m_log.Debug(" >> http-method=" + request["http-method"]); +// m_log.Debug("---------------------------\n"); Hashtable responsedata = new Hashtable(); responsedata["content_type"] = "text/html"; -- cgit v1.1 From a390541e1c114db419d9a2eb1ac576a582c35e67 Mon Sep 17 00:00:00 2001 From: sacha Date: Fri, 6 Aug 2010 14:38:11 +0000 Subject: Allowing the expected purge trash folder... Please validate !!! --- OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Server/Handlers') diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index ac6a3ab..e3d30e5 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs @@ -408,6 +408,7 @@ namespace OpenSim.Server.Handlers.Asset byte[] HandlePurgeFolder(Dictionary request) { + Dictionary result = new Dictionary(); UUID folderID = UUID.Zero; UUID.TryParse(request["ID"].ToString(), out folderID); -- cgit v1.1 From c554de75010a442753cce29ee06d2b60d7b4701a Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 7 Aug 2010 05:45:52 +0200 Subject: Correct display of landmark about info. Also correct region maturity rating in LM info. Maturity is NOT the parcel's setting, that is only for the image and text. Parcel maturity is governed by region maturity. --- OpenSim/Server/Handlers/Land/LandHandlers.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Server/Handlers') diff --git a/OpenSim/Server/Handlers/Land/LandHandlers.cs b/OpenSim/Server/Handlers/Land/LandHandlers.cs index a21f9de..561f285 100644 --- a/OpenSim/Server/Handlers/Land/LandHandlers.cs +++ b/OpenSim/Server/Handlers/Land/LandHandlers.cs @@ -66,7 +66,8 @@ namespace OpenSim.Server.Handlers.Land uint y = Convert.ToUInt32(requestData["y"]); m_log.DebugFormat("[LAND HANDLER]: Got request for land data at {0}, {1} for region {2}", x, y, regionHandle); - LandData landData = m_LocalService.GetLandData(regionHandle, x, y); + byte regionAccess; + LandData landData = m_LocalService.GetLandData(regionHandle, x, y, out regionAccess); Hashtable hash = new Hashtable(); if (landData != null) { @@ -83,6 +84,7 @@ namespace OpenSim.Server.Handlers.Land hash["SalePrice"] = landData.SalePrice.ToString(); hash["SnapshotID"] = landData.SnapshotID.ToString(); hash["UserLocation"] = landData.UserLocation.ToString(); + hash["RegionAccess"] = regionAccess.ToString(); } XmlRpcResponse response = new XmlRpcResponse(); -- cgit v1.1 From 4f15b8d4e6be1e1fe88ad32aa43595861d1005ad Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 16 Nov 2010 20:44:39 +0100 Subject: Change the way attachments are persisted. Editing a worn attachment will now save properly, as will the results of a resizer script working. Attachment positions are no longer saved on each move, but instead are saved once on logout. Attachment script states are saved as part of the attachment now when detaching. --- OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'OpenSim/Server/Handlers') diff --git a/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs b/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs index 33e5aa6..04ff83f 100644 --- a/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs @@ -162,6 +162,11 @@ namespace OpenSim.Server.Handlers.Simulation return; } + if (args.ContainsKey("modified")) + sog.HasGroupChanged = args["modified"].AsBoolean(); + else + sog.HasGroupChanged = false; + if ((args["state"] != null) && s.AllowScriptCrossings) { stateXmlStr = args["state"].AsString(); @@ -243,4 +248,4 @@ namespace OpenSim.Server.Handlers.Simulation } } -} \ No newline at end of file +} -- cgit v1.1 From 1cf8eb8a90749b215bc4e8b7beb37b927e101dce Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 21 Nov 2010 20:59:01 +0000 Subject: Start implementing Freeswitch in ROBUST --- .../Freeswitch/FreeswitchServerConnector.cs | 46 +++++++++++++- .../Freeswitch/FreeswitchServerGetHandler.cs | 72 ---------------------- 2 files changed, 45 insertions(+), 73 deletions(-) delete mode 100644 OpenSim/Server/Handlers/Freeswitch/FreeswitchServerGetHandler.cs (limited to 'OpenSim/Server/Handlers') diff --git a/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerConnector.cs b/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerConnector.cs index 07bafc8..150df45 100644 --- a/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerConnector.cs +++ b/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerConnector.cs @@ -26,18 +26,25 @@ */ using System; +using System.Collections; +using System.Web; +using System.Reflection; using Nini.Config; using OpenSim.Server.Base; using OpenSim.Services.Interfaces; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Server.Handlers.Base; +using log4net; namespace OpenSim.Server.Handlers.Freeswitch { public class FreeswitchServerConnector : ServiceConnector { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private IFreeswitchService m_FreeswitchService; private string m_ConfigName = "FreeswitchService"; + protected readonly string m_freeSwitchAPIPrefix = "/fsapi"; public FreeswitchServerConnector(IConfigSource config, IHttpServer server, string configName) : base(config, server, configName) @@ -59,7 +66,44 @@ namespace OpenSim.Server.Handlers.Freeswitch m_FreeswitchService = ServerUtils.LoadPlugin(freeswitchService, args); - server.AddStreamHandler(new FreeswitchServerGetHandler(m_FreeswitchService)); + server.AddHTTPHandler(String.Format("{0}/freeswitch-config", m_freeSwitchAPIPrefix), FreeSwitchConfigHTTPHandler); + } + + public Hashtable FreeSwitchConfigHTTPHandler(Hashtable request) + { + Hashtable response = new Hashtable(); + response["str_response_string"] = string.Empty; + + Hashtable requestBody = ParseRequestBody((string) request["body"]); + + string section = (string) requestBody["section"]; + + if (section == "directory") + response = m_FreeswitchService.HandleDirectoryRequest(requestBody); + else if (section == "dialplan") + response = m_FreeswitchService.HandleDialplanRequest(requestBody); + else + m_log.WarnFormat("[FreeSwitchVoice]: section was {0}", section); + + return response; + } + + private Hashtable ParseRequestBody(string body) + { + Hashtable bodyParams = new Hashtable(); + // split string + string [] nvps = body.Split(new Char [] {'&'}); + + foreach (string s in nvps) + { + if (s.Trim() != "") + { + string [] nvp = s.Split(new Char [] {'='}); + bodyParams.Add(HttpUtility.UrlDecode(nvp[0]), HttpUtility.UrlDecode(nvp[1])); + } + } + + return bodyParams; } } } diff --git a/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerGetHandler.cs b/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerGetHandler.cs deleted file mode 100644 index 8b41742..0000000 --- a/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerGetHandler.cs +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using Nini.Config; -using log4net; -using System; -using System.IO; -using System.Reflection; -using System.Net; -using System.Text; -using System.Text.RegularExpressions; -using System.Xml; -using System.Xml.Serialization; -using OpenSim.Server.Base; -using OpenSim.Services.Interfaces; -using OpenSim.Framework; -using OpenSim.Framework.Servers.HttpServer; - -namespace OpenSim.Server.Handlers.Freeswitch -{ - public class FreeswitchServerGetHandler : BaseStreamHandler - { - // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - //private IFreeswitchService m_FreeswitchService; - - public FreeswitchServerGetHandler(IFreeswitchService service) : - base("GET", "/api") - { - //m_FreeswitchService = service; - } - - public override byte[] Handle(string path, Stream request, - OSHttpRequest httpRequest, OSHttpResponse httpResponse) - { - byte[] result = new byte[0]; - - string[] p = SplitParams(path); - - if (p.Length == 0) - return result; - - // Process web request - - return result; - } - } -} -- cgit v1.1 From 4a54b3318b202d75bde2f1fcde3e80114df91d2e Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 23 Nov 2010 00:31:09 +0100 Subject: Fix more potential nullrefs --- OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server/Handlers') diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index 456b6fc..ce72c78 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs @@ -601,8 +601,10 @@ namespace OpenSim.Server.Handlers.Asset ret["AssetType"] = item.AssetType.ToString(); ret["BasePermissions"] = item.BasePermissions.ToString(); ret["CreationDate"] = item.CreationDate.ToString(); - ret["CreatorId"] = item.CreatorId.ToString(); - ret["CreatorData"] = item.CreatorData.ToString(); + if (item.CreatorId != null) + ret["CreatorId"] = item.CreatorId.ToString(); + else + ret["CreatorId"] = String.Empty; ret["CurrentPermissions"] = item.CurrentPermissions.ToString(); ret["Description"] = item.Description.ToString(); ret["EveryOnePermissions"] = item.EveryOnePermissions.ToString(); -- cgit v1.1 From f28dc77ab4f0abeac942b25d3547f43184d5cf2e Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 9 Dec 2010 02:01:41 +0100 Subject: Plumb a code path for the entity transfer module to ask a destination scene whether or not an agent is allowed there as a root agent. --- .../Server/Handlers/Simulation/AgentHandlers.cs | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'OpenSim/Server/Handlers') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 26516ab..8aa410b 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -115,6 +115,11 @@ namespace OpenSim.Server.Handlers.Simulation DoChildAgentDelete(request, responsedata, agentID, action, regionID); return responsedata; } + else if (method.Equals("QUERYACCESSS")) + { + DoQueryAccess(request, responsedata, agentID, regionID); + return responsedata; + } else { m_log.InfoFormat("[AGENT HANDLER]: method {0} not supported in agent message", method); @@ -305,6 +310,27 @@ namespace OpenSim.Server.Handlers.Simulation return m_SimulationService.UpdateAgent(destination, agent); } + protected virtual void DoQueryAccess(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) + { + if (m_SimulationService == null) + { + m_log.Debug("[AGENT HANDLER]: Agent QUERY called. Harmless but useless."); + responsedata["content_type"] = "application/json"; + responsedata["int_response_code"] = HttpStatusCode.NotImplemented; + responsedata["str_response_string"] = string.Empty; + + return; + } + + GridRegion destination = new GridRegion(); + destination.RegionID = regionID; + + bool result = m_SimulationService.QueryAccess(destination, id); + + responsedata["int_response_code"] = HttpStatusCode.OK; + responsedata["str_response_string"] = result.ToString(); + } + protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) { if (m_SimulationService == null) -- cgit v1.1 From 6820deed34fa87bc9b02376b382bae902052af9f Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 31 Dec 2010 15:45:08 +0100 Subject: Implement Scope ID lookup on GetLandData. Stacked regions were not handled properly --- OpenSim/Server/Handlers/Land/LandHandlers.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server/Handlers') diff --git a/OpenSim/Server/Handlers/Land/LandHandlers.cs b/OpenSim/Server/Handlers/Land/LandHandlers.cs index 561f285..b45289a 100644 --- a/OpenSim/Server/Handlers/Land/LandHandlers.cs +++ b/OpenSim/Server/Handlers/Land/LandHandlers.cs @@ -67,7 +67,7 @@ namespace OpenSim.Server.Handlers.Land m_log.DebugFormat("[LAND HANDLER]: Got request for land data at {0}, {1} for region {2}", x, y, regionHandle); byte regionAccess; - LandData landData = m_LocalService.GetLandData(regionHandle, x, y, out regionAccess); + LandData landData = m_LocalService.GetLandData(UUID.Zero, regionHandle, x, y, out regionAccess); Hashtable hash = new Hashtable(); if (landData != null) { -- cgit v1.1 From 11c742a5a8b1edd97923cc445aa43e0ba92f1bce Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 27 Jan 2011 02:16:41 +0100 Subject: Make bans work for teleport. Now teleport will complete block if the user is not allowed on the estate. If the user is allowed on no parcel, the teleport will also be blocked. If the user is allowed on a parcel, but not the desired one, the user will be shifted to the closest allowed location. --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server/Handlers') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 6d01f80..89832f4 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -115,7 +115,7 @@ namespace OpenSim.Server.Handlers.Simulation DoChildAgentDelete(request, responsedata, agentID, action, regionID); return responsedata; } - else if (method.Equals("QUERYACCESSS")) + else if (method.Equals("QUERYACCESS")) { DoQueryAccess(request, responsedata, agentID, regionID); return responsedata; -- cgit v1.1 From 657c14c5db8b0c882484926ba76aa64ec757ee07 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 28 Jan 2011 03:07:25 +0100 Subject: Fix up QueryAccess to also check parcels --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'OpenSim/Server/Handlers') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 89832f4..b33b0d5 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -331,10 +331,17 @@ namespace OpenSim.Server.Handlers.Simulation return; } + // m_log.DebugFormat("[AGENT HANDLER]: Received QUERYACCESS with {0}", (string)request["body"]); + OSDMap args = Utils.GetOSDMap((string)request["body"]); + + Vector3 position = Vector3.Zero; + if (args.ContainsKey("position")) + position = Vector3.Parse(args["position"].AsString()); + GridRegion destination = new GridRegion(); destination.RegionID = regionID; - bool result = m_SimulationService.QueryAccess(destination, id); + bool result = m_SimulationService.QueryAccess(destination, id, position); responsedata["int_response_code"] = HttpStatusCode.OK; responsedata["str_response_string"] = result.ToString(); -- cgit v1.1 From cfce0aa4482c50e3046ae44fe76d71fb70c82201 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 16 Feb 2011 05:22:05 +0100 Subject: Change the QUERYACCESS method to eliminate spurious access denied messages --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server/Handlers') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 448e321..616aef3 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -346,10 +346,17 @@ namespace OpenSim.Server.Handlers.Simulation GridRegion destination = new GridRegion(); destination.RegionID = regionID; - bool result = m_SimulationService.QueryAccess(destination, id, position); + string reason; + bool result = m_SimulationService.QueryAccess(destination, id, position, out reason); responsedata["int_response_code"] = HttpStatusCode.OK; - responsedata["str_response_string"] = result.ToString(); + + OSDMap resp = new OSDMap(2); + + resp["success"] = OSD.FromBoolean(result); + resp["reason"] = OSD.FromString(reason); + + responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); } protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) -- cgit v1.1 From 763666e2d6e82dac4ae1514df8dcbe376c6f4cac Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 8 May 2011 19:50:35 +0200 Subject: Enable compressed (gzip) fatpack transfers. --- OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs | 6 +- .../Hypergrid/GatekeeperServerConnector.cs | 2 +- .../Server/Handlers/Simulation/AgentHandlers.cs | 299 +++++++++++++-------- .../Simulation/SimulationServiceInConnector.cs | 23 +- 4 files changed, 194 insertions(+), 136 deletions(-) (limited to 'OpenSim/Server/Handlers') diff --git a/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs index f3f81b0..cf1af15 100644 --- a/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs @@ -49,13 +49,13 @@ using log4net; namespace OpenSim.Server.Handlers.Hypergrid { - public class GatekeeperAgentHandler : OpenSim.Server.Handlers.Simulation.AgentHandler + public class GatekeeperAgentHandler : OpenSim.Server.Handlers.Simulation.AgentPostHandler { // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private IGatekeeperService m_GatekeeperService; - public GatekeeperAgentHandler(IGatekeeperService gatekeeper, bool proxy) + public GatekeeperAgentHandler(IGatekeeperService gatekeeper, bool proxy) : base("/foreignagent") { m_GatekeeperService = gatekeeper; m_Proxy = proxy; @@ -65,7 +65,5 @@ namespace OpenSim.Server.Handlers.Hypergrid { return m_GatekeeperService.LoginAgent(aCircuit, destination, out reason); } - } - } diff --git a/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs index 3d0967f..0d4990a 100644 --- a/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs @@ -73,7 +73,7 @@ namespace OpenSim.Server.Handlers.Hypergrid server.AddXmlRPCHandler("link_region", hghandlers.LinkRegionRequest, false); server.AddXmlRPCHandler("get_region", hghandlers.GetRegion, false); - server.AddHTTPHandler("/foreignagent/", new GatekeeperAgentHandler(m_GatekeeperService, m_Proxy).Handler); + server.AddStreamHandler(new GatekeeperAgentHandler(m_GatekeeperService, m_Proxy)); } public GatekeeperServiceInConnector(IConfigSource config, IHttpServer server) diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index b51290d..55f011a 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -28,6 +28,7 @@ using System; using System.Collections; using System.IO; +using System.IO.Compression; using System.Reflection; using System.Net; using System.Text; @@ -53,8 +54,6 @@ namespace OpenSim.Server.Handlers.Simulation private ISimulationService m_SimulationService; - protected bool m_Proxy = false; - public AgentHandler() { } public AgentHandler(ISimulationService sim) @@ -91,16 +90,12 @@ namespace OpenSim.Server.Handlers.Simulation // Next, let's parse the verb string method = (string)request["http-method"]; + m_log.DebugFormat("[SIMULATION]: Got verb {0} in HTTP handler", method); if (method.Equals("PUT")) { DoAgentPut(request, responsedata); return responsedata; } - else if (method.Equals("POST")) - { - DoAgentPost(request, responsedata, agentID); - return responsedata; - } else if (method.Equals("GET")) { DoAgentGet(request, responsedata, agentID, regionID); @@ -132,111 +127,6 @@ namespace OpenSim.Server.Handlers.Simulation } - protected void DoAgentPost(Hashtable request, Hashtable responsedata, UUID id) - { - OSDMap args = Utils.GetOSDMap((string)request["body"]); - if (args == null) - { - responsedata["int_response_code"] = HttpStatusCode.BadRequest; - responsedata["str_response_string"] = "Bad request"; - return; - } - - // retrieve the input arguments - int x = 0, y = 0; - UUID uuid = UUID.Zero; - string regionname = string.Empty; - uint teleportFlags = 0; - if (args.ContainsKey("destination_x") && args["destination_x"] != null) - Int32.TryParse(args["destination_x"].AsString(), out x); - else - m_log.WarnFormat(" -- request didn't have destination_x"); - if (args.ContainsKey("destination_y") && args["destination_y"] != null) - Int32.TryParse(args["destination_y"].AsString(), out y); - else - m_log.WarnFormat(" -- request didn't have destination_y"); - if (args.ContainsKey("destination_uuid") && args["destination_uuid"] != null) - UUID.TryParse(args["destination_uuid"].AsString(), out uuid); - if (args.ContainsKey("destination_name") && args["destination_name"] != null) - regionname = args["destination_name"].ToString(); - if (args.ContainsKey("teleport_flags") && args["teleport_flags"] != null) - teleportFlags = args["teleport_flags"].AsUInteger(); - - GridRegion destination = new GridRegion(); - destination.RegionID = uuid; - destination.RegionLocX = x; - destination.RegionLocY = y; - destination.RegionName = regionname; - - AgentCircuitData aCircuit = new AgentCircuitData(); - try - { - aCircuit.UnpackAgentCircuitData(args); - } - catch (Exception ex) - { - m_log.InfoFormat("[AGENT HANDLER]: exception on unpacking ChildCreate message {0}", ex.Message); - responsedata["int_response_code"] = HttpStatusCode.BadRequest; - responsedata["str_response_string"] = "Bad request"; - return; - } - - OSDMap resp = new OSDMap(2); - string reason = String.Empty; - - // This is the meaning of POST agent - //m_regionClient.AdjustUserInformation(aCircuit); - //bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); - bool result = CreateAgent(destination, aCircuit, teleportFlags, out reason); - - 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; - responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); - } - - private string GetCallerIP(Hashtable request) - { - if (!m_Proxy) - return Util.GetCallerIP(request); - - // We're behind a proxy - Hashtable headers = (Hashtable)request["headers"]; - - //// DEBUG - //foreach (object o in headers.Keys) - // m_log.DebugFormat("XXX {0} = {1}", o.ToString(), (headers[o] == null? "null" : headers[o].ToString())); - - string xff = "X-Forwarded-For"; - if (headers.ContainsKey(xff.ToLower())) - xff = xff.ToLower(); - - if (!headers.ContainsKey(xff) || headers[xff] == null) - { - m_log.WarnFormat("[AGENT HANDLER]: No XFF header"); - return Util.GetCallerIP(request); - } - - m_log.DebugFormat("[AGENT HANDLER]: XFF is {0}", headers[xff]); - - IPEndPoint ep = Util.GetClientIPFromXFF((string)headers[xff]); - if (ep != null) - return ep.Address.ToString(); - - // Oops - return Util.GetCallerIP(request); - } - - // subclasses can override this - protected virtual bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) - { - return m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); - } - protected void DoAgentPut(Hashtable request, Hashtable responsedata) { OSDMap args = Utils.GetOSDMap((string)request["body"]); @@ -457,4 +347,189 @@ namespace OpenSim.Server.Handlers.Simulation } + public class AgentPostHandler : BaseStreamHandler + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private ISimulationService m_SimulationService; + protected bool m_Proxy = false; + + public AgentPostHandler(ISimulationService service) : + base("POST", "/agent") + { + m_SimulationService = service; + } + + public AgentPostHandler(string path) : + base("POST", path) + { + m_SimulationService = null; + } + + public override byte[] Handle(string path, Stream request, + OSHttpRequest httpRequest, OSHttpResponse httpResponse) + { + m_log.DebugFormat("[SIMULATION]: Stream handler called"); + + Hashtable keysvals = new Hashtable(); + Hashtable headervals = new Hashtable(); + + string[] querystringkeys = httpRequest.QueryString.AllKeys; + string[] rHeaders = httpRequest.Headers.AllKeys; + + keysvals.Add("uri", httpRequest.RawUrl); + keysvals.Add("content-type", httpRequest.ContentType); + keysvals.Add("http-method", httpRequest.HttpMethod); + + foreach (string queryname in querystringkeys) + keysvals.Add(queryname, httpRequest.QueryString[queryname]); + + foreach (string headername in rHeaders) + headervals[headername] = httpRequest.Headers[headername]; + + keysvals.Add("headers", headervals); + keysvals.Add("querystringkeys", querystringkeys); + + Stream inputStream; + if (httpRequest.ContentType == "application/x-gzip") + inputStream = new GZipStream(request, CompressionMode.Decompress); + else + inputStream = request; + + Encoding encoding = Encoding.UTF8; + StreamReader reader = new StreamReader(inputStream, encoding); + + string requestBody = reader.ReadToEnd(); + keysvals.Add("body", requestBody); + + httpResponse.StatusCode = 200; + httpResponse.ContentType = "text/html"; + httpResponse.KeepAlive = false; + + Hashtable responsedata = new Hashtable(); + + UUID agentID; + UUID regionID; + string action; + + if (!Utils.GetParams((string)keysvals["uri"], out agentID, out regionID, out action)) + { + m_log.InfoFormat("[AGENT HANDLER]: Invalid parameters for agent message {0}", keysvals["uri"]); + + httpResponse.StatusCode = 404; + + return encoding.GetBytes("false"); + } + + DoAgentPost(keysvals, responsedata, agentID); + + httpResponse.StatusCode = (int)responsedata["int_response_code"]; + return encoding.GetBytes((string)responsedata["str_response_string"]); + } + + protected void DoAgentPost(Hashtable request, Hashtable responsedata, UUID id) + { + OSDMap args = Utils.GetOSDMap((string)request["body"]); + if (args == null) + { + responsedata["int_response_code"] = HttpStatusCode.BadRequest; + responsedata["str_response_string"] = "Bad request"; + return; + } + + // retrieve the input arguments + int x = 0, y = 0; + UUID uuid = UUID.Zero; + string regionname = string.Empty; + uint teleportFlags = 0; + if (args.ContainsKey("destination_x") && args["destination_x"] != null) + Int32.TryParse(args["destination_x"].AsString(), out x); + else + m_log.WarnFormat(" -- request didn't have destination_x"); + if (args.ContainsKey("destination_y") && args["destination_y"] != null) + Int32.TryParse(args["destination_y"].AsString(), out y); + else + m_log.WarnFormat(" -- request didn't have destination_y"); + if (args.ContainsKey("destination_uuid") && args["destination_uuid"] != null) + UUID.TryParse(args["destination_uuid"].AsString(), out uuid); + if (args.ContainsKey("destination_name") && args["destination_name"] != null) + regionname = args["destination_name"].ToString(); + if (args.ContainsKey("teleport_flags") && args["teleport_flags"] != null) + teleportFlags = args["teleport_flags"].AsUInteger(); + + GridRegion destination = new GridRegion(); + destination.RegionID = uuid; + destination.RegionLocX = x; + destination.RegionLocY = y; + destination.RegionName = regionname; + + AgentCircuitData aCircuit = new AgentCircuitData(); + try + { + aCircuit.UnpackAgentCircuitData(args); + } + catch (Exception ex) + { + m_log.InfoFormat("[AGENT HANDLER]: exception on unpacking ChildCreate message {0}", ex.Message); + responsedata["int_response_code"] = HttpStatusCode.BadRequest; + responsedata["str_response_string"] = "Bad request"; + return; + } + + OSDMap resp = new OSDMap(2); + string reason = String.Empty; + + // This is the meaning of POST agent + //m_regionClient.AdjustUserInformation(aCircuit); + //bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); + bool result = CreateAgent(destination, aCircuit, teleportFlags, out reason); + + 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; + responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); + } + + private string GetCallerIP(Hashtable request) + { + if (!m_Proxy) + return Util.GetCallerIP(request); + + // We're behind a proxy + Hashtable headers = (Hashtable)request["headers"]; + + //// DEBUG + //foreach (object o in headers.Keys) + // m_log.DebugFormat("XXX {0} = {1}", o.ToString(), (headers[o] == null? "null" : headers[o].ToString())); + + string xff = "X-Forwarded-For"; + if (headers.ContainsKey(xff.ToLower())) + xff = xff.ToLower(); + + if (!headers.ContainsKey(xff) || headers[xff] == null) + { + m_log.WarnFormat("[AGENT HANDLER]: No XFF header"); + return Util.GetCallerIP(request); + } + + m_log.DebugFormat("[AGENT HANDLER]: XFF is {0}", headers[xff]); + + IPEndPoint ep = Util.GetClientIPFromXFF((string)headers[xff]); + if (ep != null) + return ep.Address.ToString(); + + // Oops + return Util.GetCallerIP(request); + } + + // subclasses can override this + protected virtual bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) + { + return m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); + } + } } diff --git a/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs b/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs index f33eda7..42d8eca 100644 --- a/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs +++ b/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs @@ -43,30 +43,15 @@ namespace OpenSim.Server.Handlers.Simulation public SimulationServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) : base(config, server, String.Empty) { - //IConfig serverConfig = config.Configs["SimulationService"]; - //if (serverConfig == null) - // throw new Exception("No section 'SimulationService' in config file"); - - //string simService = serverConfig.GetString("LocalServiceModule", - // String.Empty); - - //if (simService == String.Empty) - // throw new Exception("No SimulationService in config file"); - - //Object[] args = new Object[] { config }; m_LocalSimulationService = scene.RequestModuleInterface(); m_LocalSimulationService = m_LocalSimulationService.GetInnerService(); - //ServerUtils.LoadPlugin(simService, args); - //System.Console.WriteLine("XXXXXXXXXXXXXXXXXXX m_AssetSetvice == null? " + ((m_AssetService == null) ? "yes" : "no")); - //server.AddStreamHandler(new AgentGetHandler(m_SimulationService, m_AuthenticationService)); - //server.AddStreamHandler(new AgentPostHandler(m_SimulationService, m_AuthenticationService)); - //server.AddStreamHandler(new AgentPutHandler(m_SimulationService, m_AuthenticationService)); - //server.AddStreamHandler(new AgentDeleteHandler(m_SimulationService, m_AuthenticationService)); + // This one MUST be a stream handler because compressed fatpacks + // are pure binary and shoehorning that into a string with UTF-8 + // encoding breaks it + server.AddStreamHandler(new AgentPostHandler(m_LocalSimulationService)); server.AddHTTPHandler("/agent/", new AgentHandler(m_LocalSimulationService).Handler); server.AddHTTPHandler("/object/", new ObjectHandler(m_LocalSimulationService).Handler); - - //server.AddStreamHandler(new ObjectPostHandler(m_SimulationService, authentication)); } } } -- cgit v1.1 From 1fbf4c83004345891f7e09834a2fc35c33387ed9 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 8 May 2011 21:36:51 +0200 Subject: Remove a spammy debug I left in. Disable TP cancel button at the point of no return. --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Server/Handlers') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 55f011a..6d06cb8 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -90,7 +90,6 @@ namespace OpenSim.Server.Handlers.Simulation // Next, let's parse the verb string method = (string)request["http-method"]; - m_log.DebugFormat("[SIMULATION]: Got verb {0} in HTTP handler", method); if (method.Equals("PUT")) { DoAgentPut(request, responsedata); -- cgit v1.1 From ade09d0fa1e4c1331bedcf2a5f99402436d8f187 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 8 May 2011 23:23:33 +0200 Subject: Also compress the actual fatpacks --- .../Server/Handlers/Simulation/AgentHandlers.cs | 264 +++++++++++++-------- .../Simulation/SimulationServiceInConnector.cs | 1 + 2 files changed, 171 insertions(+), 94 deletions(-) (limited to 'OpenSim/Server/Handlers') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 6d06cb8..9f581ca 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -90,12 +90,7 @@ namespace OpenSim.Server.Handlers.Simulation // Next, let's parse the verb string method = (string)request["http-method"]; - if (method.Equals("PUT")) - { - DoAgentPut(request, responsedata); - return responsedata; - } - else if (method.Equals("GET")) + if (method.Equals("GET")) { DoAgentGet(request, responsedata, agentID, regionID); return responsedata; @@ -126,94 +121,6 @@ namespace OpenSim.Server.Handlers.Simulation } - protected void DoAgentPut(Hashtable request, Hashtable responsedata) - { - OSDMap args = Utils.GetOSDMap((string)request["body"]); - if (args == null) - { - responsedata["int_response_code"] = HttpStatusCode.BadRequest; - responsedata["str_response_string"] = "Bad request"; - return; - } - - // retrieve the input arguments - int x = 0, y = 0; - UUID uuid = UUID.Zero; - string regionname = string.Empty; - if (args.ContainsKey("destination_x") && args["destination_x"] != null) - Int32.TryParse(args["destination_x"].AsString(), out x); - if (args.ContainsKey("destination_y") && args["destination_y"] != null) - Int32.TryParse(args["destination_y"].AsString(), out y); - if (args.ContainsKey("destination_uuid") && args["destination_uuid"] != null) - UUID.TryParse(args["destination_uuid"].AsString(), out uuid); - if (args.ContainsKey("destination_name") && args["destination_name"] != null) - regionname = args["destination_name"].ToString(); - - GridRegion destination = new GridRegion(); - destination.RegionID = uuid; - destination.RegionLocX = x; - destination.RegionLocY = y; - destination.RegionName = regionname; - - string messageType; - if (args["message_type"] != null) - messageType = args["message_type"].AsString(); - else - { - m_log.Warn("[AGENT HANDLER]: Agent Put Message Type not found. "); - messageType = "AgentData"; - } - - bool result = true; - if ("AgentData".Equals(messageType)) - { - AgentData agent = new AgentData(); - try - { - agent.Unpack(args, m_SimulationService.GetScene(destination.RegionHandle)); - } - catch (Exception ex) - { - m_log.InfoFormat("[AGENT HANDLER]: exception on unpacking ChildAgentUpdate message {0}", ex.Message); - responsedata["int_response_code"] = HttpStatusCode.BadRequest; - responsedata["str_response_string"] = "Bad request"; - return; - } - - //agent.Dump(); - // This is one of the meanings of PUT agent - result = UpdateAgent(destination, agent); - - } - else if ("AgentPosition".Equals(messageType)) - { - AgentPosition agent = new AgentPosition(); - try - { - agent.Unpack(args, m_SimulationService.GetScene(destination.RegionHandle)); - } - catch (Exception ex) - { - m_log.InfoFormat("[AGENT HANDLER]: exception on unpacking ChildAgentUpdate message {0}", ex.Message); - return; - } - //agent.Dump(); - // This is one of the meanings of PUT agent - result = m_SimulationService.UpdateAgent(destination, agent); - - } - - responsedata["int_response_code"] = HttpStatusCode.OK; - responsedata["str_response_string"] = result.ToString(); - //responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); ??? instead - } - - // subclasses can override this - protected virtual bool UpdateAgent(GridRegion destination, AgentData agent) - { - return m_SimulationService.UpdateAgent(destination, agent); - } - protected virtual void DoQueryAccess(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) { if (m_SimulationService == null) @@ -531,4 +438,173 @@ namespace OpenSim.Server.Handlers.Simulation return m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); } } + + public class AgentPutHandler : BaseStreamHandler + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private ISimulationService m_SimulationService; + protected bool m_Proxy = false; + + public AgentPutHandler(ISimulationService service) : + base("PUT", "/agent") + { + m_SimulationService = service; + } + + public AgentPutHandler(string path) : + base("PUT", path) + { + m_SimulationService = null; + } + + public override byte[] Handle(string path, Stream request, + OSHttpRequest httpRequest, OSHttpResponse httpResponse) + { + m_log.DebugFormat("[SIMULATION]: Stream handler called"); + + Hashtable keysvals = new Hashtable(); + Hashtable headervals = new Hashtable(); + + string[] querystringkeys = httpRequest.QueryString.AllKeys; + string[] rHeaders = httpRequest.Headers.AllKeys; + + keysvals.Add("uri", httpRequest.RawUrl); + keysvals.Add("content-type", httpRequest.ContentType); + keysvals.Add("http-method", httpRequest.HttpMethod); + + foreach (string queryname in querystringkeys) + keysvals.Add(queryname, httpRequest.QueryString[queryname]); + + foreach (string headername in rHeaders) + headervals[headername] = httpRequest.Headers[headername]; + + keysvals.Add("headers", headervals); + keysvals.Add("querystringkeys", querystringkeys); + + Stream inputStream; + if (httpRequest.ContentType == "application/x-gzip") + inputStream = new GZipStream(request, CompressionMode.Decompress); + else + inputStream = request; + + Encoding encoding = Encoding.UTF8; + StreamReader reader = new StreamReader(inputStream, encoding); + + string requestBody = reader.ReadToEnd(); + keysvals.Add("body", requestBody); + + httpResponse.StatusCode = 200; + httpResponse.ContentType = "text/html"; + httpResponse.KeepAlive = false; + + Hashtable responsedata = new Hashtable(); + + UUID agentID; + UUID regionID; + string action; + + if (!Utils.GetParams((string)keysvals["uri"], out agentID, out regionID, out action)) + { + m_log.InfoFormat("[AGENT HANDLER]: Invalid parameters for agent message {0}", keysvals["uri"]); + + httpResponse.StatusCode = 404; + + return encoding.GetBytes("false"); + } + + DoAgentPut(keysvals, responsedata); + + httpResponse.StatusCode = (int)responsedata["int_response_code"]; + return encoding.GetBytes((string)responsedata["str_response_string"]); + } + + protected void DoAgentPut(Hashtable request, Hashtable responsedata) + { + OSDMap args = Utils.GetOSDMap((string)request["body"]); + if (args == null) + { + responsedata["int_response_code"] = HttpStatusCode.BadRequest; + responsedata["str_response_string"] = "Bad request"; + return; + } + + // retrieve the input arguments + int x = 0, y = 0; + UUID uuid = UUID.Zero; + string regionname = string.Empty; + if (args.ContainsKey("destination_x") && args["destination_x"] != null) + Int32.TryParse(args["destination_x"].AsString(), out x); + if (args.ContainsKey("destination_y") && args["destination_y"] != null) + Int32.TryParse(args["destination_y"].AsString(), out y); + if (args.ContainsKey("destination_uuid") && args["destination_uuid"] != null) + UUID.TryParse(args["destination_uuid"].AsString(), out uuid); + if (args.ContainsKey("destination_name") && args["destination_name"] != null) + regionname = args["destination_name"].ToString(); + + GridRegion destination = new GridRegion(); + destination.RegionID = uuid; + destination.RegionLocX = x; + destination.RegionLocY = y; + destination.RegionName = regionname; + + string messageType; + if (args["message_type"] != null) + messageType = args["message_type"].AsString(); + else + { + m_log.Warn("[AGENT HANDLER]: Agent Put Message Type not found. "); + messageType = "AgentData"; + } + + bool result = true; + if ("AgentData".Equals(messageType)) + { + AgentData agent = new AgentData(); + try + { + agent.Unpack(args, m_SimulationService.GetScene(destination.RegionHandle)); + } + catch (Exception ex) + { + m_log.InfoFormat("[AGENT HANDLER]: exception on unpacking ChildAgentUpdate message {0}", ex.Message); + responsedata["int_response_code"] = HttpStatusCode.BadRequest; + responsedata["str_response_string"] = "Bad request"; + return; + } + + //agent.Dump(); + // This is one of the meanings of PUT agent + result = UpdateAgent(destination, agent); + + } + else if ("AgentPosition".Equals(messageType)) + { + AgentPosition agent = new AgentPosition(); + try + { + agent.Unpack(args, m_SimulationService.GetScene(destination.RegionHandle)); + } + catch (Exception ex) + { + m_log.InfoFormat("[AGENT HANDLER]: exception on unpacking ChildAgentUpdate message {0}", ex.Message); + return; + } + //agent.Dump(); + // This is one of the meanings of PUT agent + result = m_SimulationService.UpdateAgent(destination, agent); + + } + + responsedata["int_response_code"] = HttpStatusCode.OK; + responsedata["str_response_string"] = result.ToString(); + //responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); ??? instead + } + + // subclasses can override this + protected virtual bool UpdateAgent(GridRegion destination, AgentData agent) + { + return m_SimulationService.UpdateAgent(destination, agent); + } + } } diff --git a/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs b/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs index 42d8eca..0da08f8 100644 --- a/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs +++ b/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs @@ -50,6 +50,7 @@ namespace OpenSim.Server.Handlers.Simulation // are pure binary and shoehorning that into a string with UTF-8 // encoding breaks it server.AddStreamHandler(new AgentPostHandler(m_LocalSimulationService)); + server.AddStreamHandler(new AgentPutHandler(m_LocalSimulationService)); server.AddHTTPHandler("/agent/", new AgentHandler(m_LocalSimulationService).Handler); server.AddHTTPHandler("/object/", new ObjectHandler(m_LocalSimulationService).Handler); } -- cgit v1.1 From d6b9504c84f620f0205f2f1fcf024fda7e68ea5c Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 16 Jan 2012 02:19:19 +0100 Subject: Add methods to allow the groups modules to query online status and last login --- .../Handlers/GridUser/GridUserServerPostHandler.cs | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'OpenSim/Server/Handlers') diff --git a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs index 4c0d52e..bf21255 100644 --- a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs +++ b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs @@ -88,6 +88,8 @@ namespace OpenSim.Server.Handlers.GridUser return SetPosition(request); case "getgriduserinfo": return GetGridUserInfo(request); + case "getgriduserinfos": + return GetGridUserInfos(request); } m_log.DebugFormat("[GRID USER HANDLER]: unknown method request: {0}", method); } @@ -193,6 +195,46 @@ namespace OpenSim.Server.Handlers.GridUser } + byte[] GetGridUserInfos(Dictionary request) + { + + string[] userIDs; + + if (!request.ContainsKey("AgentIDs")) + { + m_log.DebugFormat("[GRID USER HANDLER]: GetGridUserInfos called without required uuids argument"); + return FailureResult(); + } + + if (!(request["AgentIDs"] is List)) + { + m_log.DebugFormat("[GRID USER HANDLER]: GetGridUserInfos input argument was of unexpected type {0}", request["uuids"].GetType().ToString()); + return FailureResult(); + } + + userIDs = ((List)request["AgentIDs"]).ToArray(); + + GridUserInfo[] pinfos = m_GridUserService.GetGridUserInfo(userIDs); + + Dictionary result = new Dictionary(); + if ((pinfos == null) || ((pinfos != null) && (pinfos.Length == 0))) + result["result"] = "null"; + else + { + int i = 0; + foreach (GridUserInfo pinfo in pinfos) + { + Dictionary rinfoDict = pinfo.ToKeyValuePairs(); + result["griduser" + i] = rinfoDict; + i++; + } + } + + string xmlString = ServerUtils.BuildXmlResponse(result); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + private bool UnpackArgs(Dictionary request, out string user, out UUID region, out Vector3 position, out Vector3 lookAt) { user = string.Empty; -- cgit v1.1 From d3b778ebbe617a37a32c866101c75284dad8f15a Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 8 Jul 2012 06:06:33 +0200 Subject: Address map lag issue seen with non-avination viewers --- OpenSim/Server/Handlers/Map/MapGetServerConnector.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'OpenSim/Server/Handlers') diff --git a/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs b/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs index fb85d1c..4502b7d 100644 --- a/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs @@ -29,6 +29,7 @@ using System; using System.IO; using System.Net; using System.Reflection; +using System.Threading; using Nini.Config; using log4net; @@ -70,6 +71,8 @@ namespace OpenSim.Server.Handlers.MapImage class MapServerGetHandler : BaseStreamHandler { + public static ManualResetEvent ev = new ManualResetEvent(true); + // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private IMapImageService m_MapService; @@ -82,8 +85,13 @@ namespace OpenSim.Server.Handlers.MapImage public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { - byte[] result = new byte[0]; + ev.WaitOne(); + lock (ev) + { + ev.Reset(); + } + byte[] result = new byte[0]; string format = string.Empty; result = m_MapService.GetMapTile(path.Trim('/'), out format); if (result.Length > 0) @@ -100,6 +108,11 @@ namespace OpenSim.Server.Handlers.MapImage httpResponse.ContentType = "text/plain"; } + lock (ev) + { + ev.Set(); + } + return result; } -- cgit v1.1 From 8dae7928d39399c2ac3d6a0dbd9a1362b2e0f68d Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 16 Sep 2012 23:41:34 +0200 Subject: Make agent creation at destination asynchronous. Failures here are pretty much guaranteed to be fatal and the few times this would dosconnect an agent are more than made up for by the increased throughput of replying and closing the connection vs. keeping it open during the heavy work. Also causes better feedback to the viewer as the time is now split between Requesting Teleport and Connectiong to Destination. --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'OpenSim/Server/Handlers') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index d772c39..0bd8269 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -443,7 +443,15 @@ namespace OpenSim.Server.Handlers.Simulation // subclasses can override this protected virtual bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) { - return m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); + reason = String.Empty; + + Util.FireAndForget(x => + { + string r; + m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out r); + }); + + return true; } } -- cgit v1.1 From 958a8f274b8a25703935ab4092f190e9d54b8559 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 7 Dec 2013 01:29:15 +0000 Subject: Revert "Add support for user preferences (im via email)" This reverts commit 1842388bb4dcf5ecd57732ffa877b6ca1a3dec7b. --- .../Handlers/Profiles/UserProfilesConnector.cs | 2 - .../Handlers/Profiles/UserProfilesHandlers.cs | 53 ---------------------- 2 files changed, 55 deletions(-) (limited to 'OpenSim/Server/Handlers') diff --git a/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs b/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs index 6403882..28dbbc2 100644 --- a/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs +++ b/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs @@ -104,8 +104,6 @@ namespace OpenSim.Server.Handlers.Profiles Server.AddJsonRPCHandler("avatar_properties_request", handler.AvatarPropertiesRequest); Server.AddJsonRPCHandler("avatar_properties_update", handler.AvatarPropertiesUpdate); Server.AddJsonRPCHandler("avatar_interests_update", handler.AvatarInterestsUpdate); - Server.AddJsonRPCHandler("user_preferences_update", handler.UserPreferenecesUpdate); - Server.AddJsonRPCHandler("user_preferences_request", handler.UserPreferencesRequest); Server.AddJsonRPCHandler("image_assets_request", handler.AvatarImageAssetsRequest); Server.AddJsonRPCHandler("user_data_request", handler.RequestUserAppData); Server.AddJsonRPCHandler("user_data_update", handler.UpdateUserAppData); diff --git a/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs b/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs index d30cc22..f5f0794 100644 --- a/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs +++ b/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs @@ -381,59 +381,6 @@ namespace OpenSim.Server.Handlers } #endregion Interests - #region User Preferences - public bool UserPreferencesRequest(OSDMap json, ref JsonRpcResponse response) - { - if(!json.ContainsKey("params")) - { - response.Error.Code = ErrorCode.ParseError; - m_log.DebugFormat ("User Preferences Request"); - return false; - } - - string result = string.Empty; - UserPreferences prefs = new UserPreferences(); - object Prefs = (object)prefs; - OSD.DeserializeMembers(ref Prefs, (OSDMap)json["params"]); - if(Service.UserPreferencesRequest(ref prefs, ref result)) - { - response.Result = OSD.SerializeMembers(prefs); - return true; - } - - response.Error.Code = ErrorCode.InternalError; - response.Error.Message = string.Format("{0}", result); - m_log.InfoFormat("[PROFILES]: User preferences request error - {0}", response.Error.Message); - return false; - } - - public bool UserPreferenecesUpdate(OSDMap json, ref JsonRpcResponse response) - { - if(!json.ContainsKey("params")) - { - response.Error.Code = ErrorCode.ParseError; - response.Error.Message = "no parameters supplied"; - m_log.DebugFormat ("User Preferences Update Request"); - return false; - } - - string result = string.Empty; - UserPreferences prefs = new UserPreferences(); - object Prefs = (object)prefs; - OSD.DeserializeMembers(ref Prefs, (OSDMap)json["params"]); - if(Service.UserPreferencesUpdate(ref prefs, ref result)) - { - response.Result = OSD.SerializeMembers(prefs); - return true; - } - - response.Error.Code = ErrorCode.InternalError; - response.Error.Message = string.Format("{0}", result); - m_log.InfoFormat("[PROFILES]: User preferences update error - {0}", response.Error.Message); - return false; - } - #endregion User Preferences - #region Utility public bool AvatarImageAssetsRequest(OSDMap json, ref JsonRpcResponse response) { -- cgit v1.1 From 94650c43cdfee1732856da00d64a0984173d6454 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 21 Jun 2014 00:08:39 +0200 Subject: Add forgotten file --- .../Handlers/Map/MapRemoveServerConnector.cs | 249 +++++++++++++++++++++ 1 file changed, 249 insertions(+) create mode 100644 OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs (limited to 'OpenSim/Server/Handlers') diff --git a/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs b/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs new file mode 100644 index 0000000..80e3535 --- /dev/null +++ b/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs @@ -0,0 +1,249 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using System.Xml; + +using Nini.Config; +using log4net; +using OpenMetaverse; + +using OpenSim.Framework; +using OpenSim.Server.Base; +using OpenSim.Services.Interfaces; +using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Server.Handlers.Base; + +using GridRegion = OpenSim.Services.Interfaces.GridRegion; + +namespace OpenSim.Server.Handlers.MapImage +{ + public class MapRemoveServiceConnector : ServiceConnector + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private IMapImageService m_MapService; + private IGridService m_GridService; + private string m_ConfigName = "MapImageService"; + + public MapRemoveServiceConnector(IConfigSource config, IHttpServer server, string configName) : + base(config, server, configName) + { + IConfig serverConfig = config.Configs[m_ConfigName]; + if (serverConfig == null) + throw new Exception(String.Format("No section {0} in config file", m_ConfigName)); + + string mapService = serverConfig.GetString("LocalServiceModule", + String.Empty); + + if (mapService == String.Empty) + throw new Exception("No LocalServiceModule in config file"); + + Object[] args = new Object[] { config }; + m_MapService = ServerUtils.LoadPlugin(mapService, args); + + string gridService = serverConfig.GetString("GridService", String.Empty); + if (gridService != string.Empty) + m_GridService = ServerUtils.LoadPlugin(gridService, args); + + if (m_GridService != null) + m_log.InfoFormat("[MAP IMAGE HANDLER]: GridService check is ON"); + else + m_log.InfoFormat("[MAP IMAGE HANDLER]: GridService check is OFF"); + + bool proxy = serverConfig.GetBoolean("HasProxy", false); + server.AddStreamHandler(new MapServerRemoveHandler(m_MapService, m_GridService, proxy)); + + } + } + + class MapServerRemoveHandler : BaseStreamHandler + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private IMapImageService m_MapService; + private IGridService m_GridService; + bool m_Proxy; + + public MapServerRemoveHandler(IMapImageService service, IGridService grid, bool proxy) : + base("POST", "/removemap") + { + m_MapService = service; + m_GridService = grid; + m_Proxy = proxy; + } + + public override byte[] Handle(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) + { +// m_log.DebugFormat("[MAP SERVICE IMAGE HANDLER]: Received {0}", path); + StreamReader sr = new StreamReader(requestData); + string body = sr.ReadToEnd(); + sr.Close(); + body = body.Trim(); + + try + { + Dictionary request = ServerUtils.ParseQueryString(body); + + if (!request.ContainsKey("X") || !request.ContainsKey("Y")) + { + httpResponse.StatusCode = (int)OSHttpStatusCode.ClientErrorBadRequest; + return FailureResult("Bad request."); + } + int x = 0, y = 0; + Int32.TryParse(request["X"].ToString(), out x); + Int32.TryParse(request["Y"].ToString(), out y); + + m_log.DebugFormat("[MAP REMOVE SERVER CONNECTOR]: Received position data for region at {0}-{1}", x, y); + + if (m_GridService != null) + { + System.Net.IPAddress ipAddr = GetCallerIP(httpRequest); + GridRegion r = m_GridService.GetRegionByPosition(UUID.Zero, x * (int)Constants.RegionSize, y * (int)Constants.RegionSize); + if (r != null) + { + if (r.ExternalEndPoint.Address.ToString() != ipAddr.ToString()) + { + m_log.WarnFormat("[MAP IMAGE HANDLER]: IP address {0} may be trying to impersonate region in IP {1}", ipAddr, r.ExternalEndPoint.Address); + return FailureResult("IP address of caller does not match IP address of registered region"); + } + + } + else + { + m_log.WarnFormat("[MAP IMAGE HANDLER]: IP address {0} may be rogue. Region not found at coordinates {1}-{2}", + ipAddr, x, y); + return FailureResult("Region not found at given coordinates"); + } + } + + string reason = string.Empty; + bool result = m_MapService.RemoveMapTile(x, y, out reason); + + if (result) + return SuccessResult(); + else + return FailureResult(reason); + + } + catch (Exception e) + { + m_log.ErrorFormat("[MAP SERVICE IMAGE HANDLER]: Exception {0} {1}", e.Message, e.StackTrace); + } + + return FailureResult("Unexpected server error"); + } + + private byte[] SuccessResult() + { + XmlDocument doc = new XmlDocument(); + + XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration, + "", ""); + + doc.AppendChild(xmlnode); + + XmlElement rootElement = doc.CreateElement("", "ServerResponse", + ""); + + doc.AppendChild(rootElement); + + XmlElement result = doc.CreateElement("", "Result", ""); + result.AppendChild(doc.CreateTextNode("Success")); + + rootElement.AppendChild(result); + + return DocToBytes(doc); + } + + private byte[] FailureResult(string msg) + { + XmlDocument doc = new XmlDocument(); + + XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration, + "", ""); + + doc.AppendChild(xmlnode); + + XmlElement rootElement = doc.CreateElement("", "ServerResponse", + ""); + + doc.AppendChild(rootElement); + + XmlElement result = doc.CreateElement("", "Result", ""); + result.AppendChild(doc.CreateTextNode("Failure")); + + rootElement.AppendChild(result); + + XmlElement message = doc.CreateElement("", "Message", ""); + message.AppendChild(doc.CreateTextNode(msg)); + + rootElement.AppendChild(message); + + return DocToBytes(doc); + } + + private byte[] DocToBytes(XmlDocument doc) + { + MemoryStream ms = new MemoryStream(); + XmlTextWriter xw = new XmlTextWriter(ms, null); + xw.Formatting = Formatting.Indented; + doc.WriteTo(xw); + xw.Flush(); + + return ms.ToArray(); + } + + private System.Net.IPAddress GetCallerIP(IOSHttpRequest request) + { + if (!m_Proxy) + return request.RemoteIPEndPoint.Address; + + // We're behind a proxy + string xff = "X-Forwarded-For"; + string xffValue = request.Headers[xff.ToLower()]; + if (xffValue == null || (xffValue != null && xffValue == string.Empty)) + xffValue = request.Headers[xff]; + + if (xffValue == null || (xffValue != null && xffValue == string.Empty)) + { + m_log.WarnFormat("[MAP IMAGE HANDLER]: No XFF header"); + return request.RemoteIPEndPoint.Address; + } + + System.Net.IPEndPoint ep = Util.GetClientIPFromXFF(xffValue); + if (ep != null) + return ep.Address; + + // Oops + return request.RemoteIPEndPoint.Address; + } + + } +} -- cgit v1.1 From cbd7c7b9ecbe7bbe19d5c675322206bc8a977c5f Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 23 Aug 2014 17:27:01 +0200 Subject: Change the map tile system to be multi-grid hosting compatible --- OpenSim/Server/Handlers/Map/MapAddServerConnector.cs | 5 ++++- OpenSim/Server/Handlers/Map/MapGetServerConnector.cs | 12 +++++++++++- OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs | 5 ++++- 3 files changed, 19 insertions(+), 3 deletions(-) (limited to 'OpenSim/Server/Handlers') diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs index d438fc7..7ee347c 100644 --- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs @@ -117,8 +117,11 @@ namespace OpenSim.Server.Handlers.MapImage return FailureResult("Bad request."); } int x = 0, y = 0; + UUID scopeID = new UUID("07f8d88e-cd5e-4239-a0ed-843f75d09992"); Int32.TryParse(request["X"].ToString(), out x); Int32.TryParse(request["Y"].ToString(), out y); + if (request.ContainsKey("SCOPE")) + UUID.TryParse(request["SCOPE"].ToString(), out scopeID); m_log.DebugFormat("[MAP ADD SERVER CONNECTOR]: Received map data for region at {0}-{1}", x, y); @@ -151,7 +154,7 @@ namespace OpenSim.Server.Handlers.MapImage byte[] data = Convert.FromBase64String(request["DATA"].ToString()); string reason = string.Empty; - bool result = m_MapService.AddMapTile(x, y, data, out reason); + bool result = m_MapService.AddMapTile(x, y, data, scopeID, out reason); if (result) return SuccessResult(); diff --git a/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs b/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs index bd1ddbd..e2c8f35 100644 --- a/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs @@ -38,6 +38,7 @@ using OpenSim.Server.Base; using OpenSim.Services.Interfaces; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Server.Handlers.Base; +using OpenMetaverse; namespace OpenSim.Server.Handlers.MapImage { @@ -93,7 +94,16 @@ namespace OpenSim.Server.Handlers.MapImage byte[] result = new byte[0]; string format = string.Empty; - result = m_MapService.GetMapTile(path.Trim('/'), out format); + + UUID scopeID = new UUID("07f8d88e-cd5e-4239-a0ed-843f75d09992"); + + string[] bits = path.Trim('/').Split(new char[] {'/'}); + if (bits.Length > 1) + { + scopeID = new UUID(bits[0]); + path = bits[1]; + } + result = m_MapService.GetMapTile(path.Trim('/'), scopeID, out format); if (result.Length > 0) { httpResponse.StatusCode = (int)HttpStatusCode.OK; diff --git a/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs b/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs index 80e3535..8a31579 100644 --- a/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs @@ -119,6 +119,9 @@ namespace OpenSim.Server.Handlers.MapImage int x = 0, y = 0; Int32.TryParse(request["X"].ToString(), out x); Int32.TryParse(request["Y"].ToString(), out y); + UUID scopeID = new UUID("07f8d88e-cd5e-4239-a0ed-843f75d09992"); + if (request.ContainsKey("SCOPE")) + UUID.TryParse(request["SCOPE"].ToString(), out scopeID); m_log.DebugFormat("[MAP REMOVE SERVER CONNECTOR]: Received position data for region at {0}-{1}", x, y); @@ -144,7 +147,7 @@ namespace OpenSim.Server.Handlers.MapImage } string reason = string.Empty; - bool result = m_MapService.RemoveMapTile(x, y, out reason); + bool result = m_MapService.RemoveMapTile(x, y, scopeID, out reason); if (result) return SuccessResult(); -- cgit v1.1 From 5f51abada98a0edfbfb6823abb0364f0620d0f97 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 23 Aug 2014 18:16:11 +0200 Subject: If GridUserService is asked for a nonexistent user, bail gracefully --- OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Server/Handlers') diff --git a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs index 0b98e9a..9199c68 100644 --- a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs +++ b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs @@ -184,6 +184,9 @@ namespace OpenSim.Server.Handlers.GridUser GridUserInfo guinfo = m_GridUserService.GetGridUserInfo(user); + if (guinfo == null) + return FailureResult(); + Dictionary result = new Dictionary(); if (guinfo != null) result["result"] = guinfo.ToKeyValuePairs(); -- cgit v1.1 From 68ea1f7776e5a3457dd995fb80cc10e77b122dad Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 24 Sep 2014 17:56:58 +0100 Subject: TEST do createAgent sync, forcing grid services and other regions to wait for it to complet. This is not that good, but maybe needed --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server/Handlers') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 964ccf8..62fe3c9 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -387,14 +387,19 @@ namespace OpenSim.Server.Handlers.Simulation protected virtual bool CreateAgent(GridRegion gatekeeper, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason) { reason = String.Empty; - +/* Util.FireAndForget(x => { string r; m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out r); - }); + }); + return true; +*/ + + return m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); + } } -- cgit v1.1 From c9079360b9b44443a9394f6ee5fbff741e7ccced Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 24 Sep 2014 18:37:59 +0100 Subject: coment out stack trace at newUserConnection, add log msh at createAgent --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server/Handlers') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 62fe3c9..1087a71 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -397,8 +397,9 @@ namespace OpenSim.Server.Handlers.Simulation return true; */ - - return m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); + bool ret = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); + m_log.DebugFormat("[AGENT HANDLER]: CreateAgent {0} {1}", ret.ToString(),reason); + return ret; } } -- cgit v1.1 From df773ee8c37d3d6c9de32d76cc0632298b30e93b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 24 Sep 2014 20:57:23 +0100 Subject: make CreateAgent sync for logins, async for other cases --- .../Server/Handlers/Simulation/AgentHandlers.cs | 31 +++++++++++++--------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'OpenSim/Server/Handlers') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 1087a71..466b6f8 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -387,20 +387,25 @@ namespace OpenSim.Server.Handlers.Simulation protected virtual bool CreateAgent(GridRegion gatekeeper, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason) { reason = String.Empty; -/* - Util.FireAndForget(x => + if ((teleportFlags & (uint)TeleportFlags.ViaLogin) == 0) { - string r; - m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out r); - - }); - - return true; -*/ - bool ret = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); - m_log.DebugFormat("[AGENT HANDLER]: CreateAgent {0} {1}", ret.ToString(),reason); - return ret; - + Util.FireAndForget(x => + { + string r; + m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out r); + m_log.DebugFormat("[AGENT HANDLER]: ASYNC CreateAgent {0} {1}", r); + }); + + return true; + } + else + { + + bool ret = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); + m_log.DebugFormat("[AGENT HANDLER]: SYNC CreateAgent {0} {1}", ret.ToString(), reason); + return ret; + } + } } -- cgit v1.1 From 45739e3d5ce0ba96bb2c9f2f226cfabf627f6028 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 24 Sep 2014 23:10:15 +0200 Subject: Fix a string format --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server/Handlers') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 466b6f8..ce0e120 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -393,7 +393,7 @@ namespace OpenSim.Server.Handlers.Simulation { string r; m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out r); - m_log.DebugFormat("[AGENT HANDLER]: ASYNC CreateAgent {0} {1}", r); + m_log.DebugFormat("[AGENT HANDLER]: ASYNC CreateAgent {0}", r); }); return true; -- cgit v1.1 From fd79f75ba6766e1edc196a73dd05fc5f806f82b2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 24 Oct 2014 02:12:30 +0100 Subject: TEST**** wingridproxy detection at grid login. Untested possible not very reliable. Adds some load even on region servers because of code at BaseHttpServer. --- OpenSim/Server/Handlers/Login/LLLoginHandlers.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'OpenSim/Server/Handlers') diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs index f2a5678..5d672c3 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs @@ -132,8 +132,13 @@ namespace OpenSim.Server.Handlers.Login //m_log.InfoFormat("[LOGIN]: XMLRPC Login Requested for {0} {1}, starting in {2}, using {3}", first, last, startLocation, clientVersion); + + bool LibOMVclient = false; + if (request.Params.Count > 4 && (string)request.Params[4] == "gridproxy") + LibOMVclient = true; + LoginResponse reply = null; - reply = m_LocalService.Login(first, last, passwd, startLocation, scopeID, clientVersion, channel, mac, id0, remoteClient); + reply = m_LocalService.Login(first, last, passwd, startLocation, scopeID, clientVersion, channel, mac, id0, remoteClient, LibOMVclient); XmlRpcResponse response = new XmlRpcResponse(); response.Value = reply.ToHashtable(); @@ -216,7 +221,7 @@ namespace OpenSim.Server.Handlers.Login LoginResponse reply = null; reply = m_LocalService.Login(map["first"].AsString(), map["last"].AsString(), map["passwd"].AsString(), startLocation, scopeID, - map["version"].AsString(), map["channel"].AsString(), map["mac"].AsString(), map["id0"].AsString(), remoteClient); + map["version"].AsString(), map["channel"].AsString(), map["mac"].AsString(), map["id0"].AsString(), remoteClient,false); return reply.ToOSDMap(); } @@ -259,7 +264,7 @@ namespace OpenSim.Server.Handlers.Login (sender as WebSocketHttpServerHandler).GetRemoteIPEndpoint(); LoginResponse reply = null; reply = m_LocalService.Login(first, last, passwd, start, scope, version, - channel, mac, id0, endPoint); + channel, mac, id0, endPoint,false); sock.SendMessage(OSDParser.SerializeJsonString(reply.ToOSDMap())); } -- cgit v1.1 From cf402812b74f02ca54435c81512db541e5cf13bd Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 10 Mar 2015 01:03:31 +0100 Subject: Fix content type checking to confirm to newer core versions --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server/Handlers') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index ce0e120..f912758 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -233,7 +233,7 @@ namespace OpenSim.Server.Handlers.Simulation Encoding encoding = Encoding.UTF8; Stream inputStream = null; - if (httpRequest.ContentType == "application/x-gzip") + if ((httpRequest.ContentType == "application/x-gzip" || httpRequest.Headers["Content-Encoding"] == "gzip") || (httpRequest.Headers["X-Content-Encoding"] == "gzip")) inputStream = new GZipStream(request, CompressionMode.Decompress); else if (httpRequest.ContentType == "application/json") inputStream = request; -- cgit v1.1 From 07dead7dcb8b0f2a27a50748e4a460d9669903fc Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sun, 29 Mar 2015 14:25:12 -0700 Subject: varregion: any conversions of use of Constants.RegionSize converted into Util.cs routines to convert region coords to and from world coords or handles. --- OpenSim/Server/Handlers/Map/MapAddServerConnector.cs | 2 +- OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server/Handlers') diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs index 7ee347c..d2fbfa6 100644 --- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs @@ -133,7 +133,7 @@ namespace OpenSim.Server.Handlers.MapImage if (m_GridService != null) { System.Net.IPAddress ipAddr = GetCallerIP(httpRequest); - GridRegion r = m_GridService.GetRegionByPosition(UUID.Zero, x * (int)Constants.RegionSize, y * (int)Constants.RegionSize); + GridRegion r = m_GridService.GetRegionByPosition(UUID.Zero, (int)Util.RegionToWorldLoc((uint)x), (int)Util.RegionToWorldLoc((uint)y)); if (r != null) { if (r.ExternalEndPoint.Address.ToString() != ipAddr.ToString()) diff --git a/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs b/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs index 8a31579..88d774a 100644 --- a/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs @@ -128,7 +128,7 @@ namespace OpenSim.Server.Handlers.MapImage if (m_GridService != null) { System.Net.IPAddress ipAddr = GetCallerIP(httpRequest); - GridRegion r = m_GridService.GetRegionByPosition(UUID.Zero, x * (int)Constants.RegionSize, y * (int)Constants.RegionSize); + GridRegion r = m_GridService.GetRegionByPosition(UUID.Zero, (int)Util.RegionToWorldLoc((uint)x), (int)Util.RegionToWorldLoc((uint)y)); if (r != null) { if (r.ExternalEndPoint.Address.ToString() != ipAddr.ToString()) -- cgit v1.1 From ce883e9b436a0d63cfe1d5c81f83477a266e727e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 26 Aug 2015 05:29:08 +0100 Subject: add more of the v03 checks and homeURL. Sending side only for now --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server/Handlers') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index f912758..76b593a 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -117,7 +117,7 @@ namespace OpenSim.Server.Handlers.Simulation } - protected virtual void DoQueryAccess(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) + protected virtual void DoQueryAccess(Hashtable request, Hashtable responsedata, UUID agentID, UUID regionID) { if (m_SimulationService == null) { @@ -132,16 +132,28 @@ namespace OpenSim.Server.Handlers.Simulation // m_log.DebugFormat("[AGENT HANDLER]: Received QUERYACCESS with {0}", (string)request["body"]); OSDMap args = Utils.GetOSDMap((string)request["body"]); + bool viaTeleport = true; + if (args.ContainsKey("viaTeleport")) + viaTeleport = args["viaTeleport"].AsBoolean(); + Vector3 position = Vector3.Zero; if (args.ContainsKey("position")) position = Vector3.Parse(args["position"].AsString()); + string agentHomeURI = null; + if (args.ContainsKey("agent_home_uri")) + agentHomeURI = args["agent_home_uri"].AsString(); + + string theirVersion = string.Empty; + if (args.ContainsKey("my_version")) + theirVersion = args["my_version"].AsString(); + GridRegion destination = new GridRegion(); destination.RegionID = regionID; string reason; string version; - bool result = m_SimulationService.QueryAccess(destination, id, position, out version, out reason); + bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, theirVersion, out version, out reason); responsedata["int_response_code"] = HttpStatusCode.OK; -- cgit v1.1 From f31f9002de555d8277a6d4cc008bba4069e7cadc Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 29 Aug 2015 00:32:36 +0100 Subject: change default scopeID to UUID.Zero --- OpenSim/Server/Handlers/Map/MapAddServerConnector.cs | 3 ++- OpenSim/Server/Handlers/Map/MapGetServerConnector.cs | 3 ++- OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) (limited to 'OpenSim/Server/Handlers') diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs index d2fbfa6..ea68114 100644 --- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs @@ -117,7 +117,8 @@ namespace OpenSim.Server.Handlers.MapImage return FailureResult("Bad request."); } int x = 0, y = 0; - UUID scopeID = new UUID("07f8d88e-cd5e-4239-a0ed-843f75d09992"); +// UUID scopeID = new UUID("07f8d88e-cd5e-4239-a0ed-843f75d09992"); + UUID scopeID = UUID.Zero; Int32.TryParse(request["X"].ToString(), out x); Int32.TryParse(request["Y"].ToString(), out y); if (request.ContainsKey("SCOPE")) diff --git a/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs b/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs index e2c8f35..1ae669c 100644 --- a/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs @@ -95,7 +95,8 @@ namespace OpenSim.Server.Handlers.MapImage byte[] result = new byte[0]; string format = string.Empty; - UUID scopeID = new UUID("07f8d88e-cd5e-4239-a0ed-843f75d09992"); +// UUID scopeID = new UUID("07f8d88e-cd5e-4239-a0ed-843f75d09992"); + UUID scopeID = UUID.Zero; string[] bits = path.Trim('/').Split(new char[] {'/'}); if (bits.Length > 1) diff --git a/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs b/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs index 88d774a..4f8f7e1 100644 --- a/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs @@ -119,7 +119,8 @@ namespace OpenSim.Server.Handlers.MapImage int x = 0, y = 0; Int32.TryParse(request["X"].ToString(), out x); Int32.TryParse(request["Y"].ToString(), out y); - UUID scopeID = new UUID("07f8d88e-cd5e-4239-a0ed-843f75d09992"); +// UUID scopeID = new UUID("07f8d88e-cd5e-4239-a0ed-843f75d09992"); + UUID scopeID = UUID.Zero; if (request.ContainsKey("SCOPE")) UUID.TryParse(request["SCOPE"].ToString(), out scopeID); -- cgit v1.1