diff --git a/OpenSim/Capabilities/Caps.cs b/OpenSim/Capabilities/Caps.cs index e188896bc5..56ccfd68d0 100644 --- a/OpenSim/Capabilities/Caps.cs +++ b/OpenSim/Capabilities/Caps.cs @@ -50,8 +50,8 @@ namespace OpenSim.Framework.Capabilities public class Caps { - private static readonly ILog m_log = - LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_log = +// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private string m_httpListenerHostName; private uint m_httpListenPort; diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs index 00ff3d0b5b..105a1e028b 100644 --- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs +++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs @@ -73,7 +73,7 @@ namespace OpenSim.Capabilities.Handlers string textureStr = query.GetOne("texture_id"); string format = query.GetOne("format"); - m_log.DebugFormat("[GETTEXTURE]: called {0}", textureStr); + //m_log.DebugFormat("[GETTEXTURE]: called {0}", textureStr); if (m_assetService == null) { diff --git a/OpenSim/Data/MSSQL/Resources/GridUserStore.migrations b/OpenSim/Data/MSSQL/Resources/GridUserStore.migrations new file mode 100644 index 0000000000..7a7cecdb40 --- /dev/null +++ b/OpenSim/Data/MSSQL/Resources/GridUserStore.migrations @@ -0,0 +1,19 @@ +:VERSION 1 # -------------------------- + +BEGIN TRANSACTION + +CREATE TABLE "GridUser" ( + "UserID" VARCHAR(255) NOT NULL, + "HomeRegionID" CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', + "HomePosition" CHAR(64) NOT NULL DEFAULT '<0,0,0>', + "HomeLookAt" CHAR(64) NOT NULL DEFAULT '<0,0,0>', + "LastRegionID" CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', + "LastPosition" CHAR(64) NOT NULL DEFAULT '<0,0,0>', + "LastLookAt" CHAR(64) NOT NULL DEFAULT '<0,0,0>', + "Online" CHAR(5) NOT NULL DEFAULT 'false', + "Login" CHAR(16) NOT NULL DEFAULT '0', + "Logout" CHAR(16) NOT NULL DEFAULT '0', + PRIMARY KEY ("UserID") +) + +COMMIT diff --git a/OpenSim/Data/MySQL/MySQLAvatarData.cs b/OpenSim/Data/MySQL/MySQLAvatarData.cs index 5611302f43..8c841abc06 100644 --- a/OpenSim/Data/MySQL/MySQLAvatarData.cs +++ b/OpenSim/Data/MySQL/MySQLAvatarData.cs @@ -43,7 +43,7 @@ namespace OpenSim.Data.MySQL public class MySQLAvatarData : MySQLGenericTableHandler, IAvatarData { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public MySQLAvatarData(string connectionString, string realm) : base(connectionString, realm, "Avatar") diff --git a/OpenSim/Data/MySQL/MySQLEstateData.cs b/OpenSim/Data/MySQL/MySQLEstateData.cs index 86416d1775..9dcf5e2adc 100644 --- a/OpenSim/Data/MySQL/MySQLEstateData.cs +++ b/OpenSim/Data/MySQL/MySQLEstateData.cs @@ -48,7 +48,7 @@ namespace OpenSim.Data.MySQL private string m_connectionString; private long m_waitTimeout; private long m_waitTimeoutLeeway = 60 * TimeSpan.TicksPerSecond; - private long m_lastConnectionUse; +// private long m_lastConnectionUse; private FieldInfo[] m_Fields; private Dictionary m_FieldMap = @@ -127,7 +127,7 @@ namespace OpenSim.Data.MySQL } } - m_lastConnectionUse = DateTime.Now.Ticks; +// m_lastConnectionUse = DateTime.Now.Ticks; m_log.DebugFormat( "[REGION DB]: Connection wait timeout {0} seconds", diff --git a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs index 50b6dbef42..cfffbd8739 100644 --- a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs +++ b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs @@ -39,7 +39,7 @@ namespace OpenSim.Data.MySQL { public class MySQLGenericTableHandler : MySqlFramework where T: class, new() { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected Dictionary m_Fields = new Dictionary(); diff --git a/OpenSim/Data/MySQL/MySQLPresenceData.cs b/OpenSim/Data/MySQL/MySQLPresenceData.cs index 2390febd7f..fc625f0057 100644 --- a/OpenSim/Data/MySQL/MySQLPresenceData.cs +++ b/OpenSim/Data/MySQL/MySQLPresenceData.cs @@ -43,7 +43,7 @@ namespace OpenSim.Data.MySQL public class MySQLPresenceData : MySQLGenericTableHandler, IPresenceData { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public MySQLPresenceData(string connectionString, string realm) : base(connectionString, realm, "Presence") diff --git a/OpenSim/Data/MySQL/MySQLXInventoryData.cs b/OpenSim/Data/MySQL/MySQLXInventoryData.cs index 287c4dda7b..481da493a3 100644 --- a/OpenSim/Data/MySQL/MySQLXInventoryData.cs +++ b/OpenSim/Data/MySQL/MySQLXInventoryData.cs @@ -189,7 +189,7 @@ namespace OpenSim.Data.MySQL { cmd.ExecuteNonQuery(); } - catch (Exception e) + catch (Exception) { return false; } diff --git a/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs b/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs index c54bd743b3..c3b65bbaa2 100644 --- a/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs +++ b/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs @@ -33,7 +33,7 @@ using System.Reflection; using log4net; using OpenMetaverse; using OpenSim.Framework; -using log4net; + #if CSharpSqlite using Community.CsharpSqlite.Sqlite; #else @@ -49,7 +49,6 @@ namespace OpenSim.Data.SQLite private string m_Realm; private List m_ColumnNames; private int m_LastExpire; - private string m_connectionString; protected static SqliteConnection m_Connection; private static bool m_initialized = false; @@ -58,7 +57,6 @@ namespace OpenSim.Data.SQLite : base(connectionString) { m_Realm = realm; - m_connectionString = connectionString; if (!m_initialized) { diff --git a/OpenSim/Data/SQLite/SQLiteAvatarData.cs b/OpenSim/Data/SQLite/SQLiteAvatarData.cs index 60a1a3e9f7..faf34da573 100644 --- a/OpenSim/Data/SQLite/SQLiteAvatarData.cs +++ b/OpenSim/Data/SQLite/SQLiteAvatarData.cs @@ -47,7 +47,7 @@ namespace OpenSim.Data.SQLite public class SQLiteAvatarData : SQLiteGenericTableHandler, IAvatarData { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public SQLiteAvatarData(string connectionString, string realm) : base(connectionString, realm, "Avatar") diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index 28fe3ba889..710a57dad5 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs @@ -460,7 +460,7 @@ namespace OpenSim.Framework { info["state"] = OSD.FromString(AttachmentObjectStates[i++]); } - catch (IndexOutOfRangeException e) + catch (IndexOutOfRangeException) { m_log.WarnFormat("[CHILD AGENT DATA]: scripts list is shorter than object list."); } diff --git a/OpenSim/Framework/ConfigSettings.cs b/OpenSim/Framework/ConfigSettings.cs index be7734128f..50328d744e 100644 --- a/OpenSim/Framework/ConfigSettings.cs +++ b/OpenSim/Framework/ConfigSettings.cs @@ -29,113 +29,13 @@ namespace OpenSim.Framework { public class ConfigSettings { - private string m_physicsEngine; - - public string PhysicsEngine - { - get { return m_physicsEngine; } - set { m_physicsEngine = value; } - } - private string m_meshEngineName; - - public string MeshEngineName - { - get { return m_meshEngineName; } - set { m_meshEngineName = value; } - } - - private bool m_see_into_region_from_neighbor; - - public bool See_into_region_from_neighbor - { - get { return m_see_into_region_from_neighbor; } - set { m_see_into_region_from_neighbor = value; } - } - - private string m_storageDll; - - public string StorageDll - { - get { return m_storageDll; } - set { m_storageDll = value; } - } - - private string m_clientstackDll; - - public string ClientstackDll - { - get { return m_clientstackDll; } - set { m_clientstackDll = value; } - } - - private bool m_physicalPrim; - - public bool PhysicalPrim - { - get { return m_physicalPrim; } - set { m_physicalPrim = value; } - } - - private bool m_standaloneAuthenticate = false; - - public bool StandaloneAuthenticate - { - get { return m_standaloneAuthenticate; } - set { m_standaloneAuthenticate = value; } - } - - private string m_standaloneWelcomeMessage = null; - - public string StandaloneWelcomeMessage - { - get { return m_standaloneWelcomeMessage; } - set { m_standaloneWelcomeMessage = value; } - } - - private string m_standaloneInventoryPlugin; - - public string StandaloneInventoryPlugin - { - get { return m_standaloneInventoryPlugin; } - set { m_standaloneInventoryPlugin = value; } - } - - private string m_standaloneUserPlugin; - - public string StandaloneUserPlugin - { - get { return m_standaloneUserPlugin; } - set { m_standaloneUserPlugin = value; } - } - - private string m_standaloneInventorySource; - - public string StandaloneInventorySource - { - get { return m_standaloneInventorySource; } - set { m_standaloneInventorySource = value; } - } - - private string m_standaloneUserSource; - - public string StandaloneUserSource - { - get { return m_standaloneUserSource; } - set { m_standaloneUserSource = value; } - } - - protected string m_librariesXMLFile; - public string LibrariesXMLFile - { - get - { - return m_librariesXMLFile; - } - set - { - m_librariesXMLFile = value; - } - } + public string PhysicsEngine { get; set; } + public string MeshEngineName { get; set; } + public bool See_into_region_from_neighbor { get; set; } + public string StorageDll { get; set; } + public string ClientstackDll { get; set; } + public bool PhysicalPrim { get; set; } + public string LibrariesXMLFile { get; set; } public const uint DefaultAssetServerHttpPort = 8003; public const uint DefaultRegionHttpPort = 9000; @@ -146,4 +46,4 @@ namespace OpenSim.Framework public const uint DefaultGridServerHttpPort = 8003; public const uint DefaultInventoryServerHttpPort = 8003; } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index add3411ac8..c9bccb065b 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -78,7 +78,7 @@ namespace OpenSim.Framework public delegate void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag); - public delegate void RequestMapName(IClientAPI remoteClient, string mapName); + public delegate void RequestMapName(IClientAPI remoteClient, string mapName, uint flags); public delegate void TeleportLocationRequest( IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags); diff --git a/OpenSim/Framework/MainServer.cs b/OpenSim/Framework/MainServer.cs index 0515b166e2..a3e0a26bb7 100644 --- a/OpenSim/Framework/MainServer.cs +++ b/OpenSim/Framework/MainServer.cs @@ -52,6 +52,11 @@ namespace OpenSim.Framework return GetHttpServer(port,null); } + public static void AddHttpServer(BaseHttpServer server) + { + m_Servers.Add(server.Port, server); + } + public static IHttpServer GetHttpServer(uint port, IPAddress ipaddr) { if (port == 0) diff --git a/OpenSim/Framework/NetworkServersInfo.cs b/OpenSim/Framework/NetworkServersInfo.cs index b25f8b9f60..5bb4111c90 100644 --- a/OpenSim/Framework/NetworkServersInfo.cs +++ b/OpenSim/Framework/NetworkServersInfo.cs @@ -49,6 +49,12 @@ namespace OpenSim.Framework public string HttpSSLCN = ""; public uint httpSSLPort = 9001; + // "Out of band" managemnt https + public bool ssl_listener = false; + public uint https_port = 0; + public string cert_path = String.Empty; + public string cert_pass = String.Empty; + public string MessagingURL = String.Empty; public NetworkServersInfo() @@ -86,6 +92,15 @@ namespace OpenSim.Framework secureInventoryServer = config.Configs["Network"].GetBoolean("secure_inventory_server", true); MessagingURL = config.Configs["Network"].GetString("messaging_server_url", string.Empty); + + // "Out of band management https" + ssl_listener = config.Configs["Network"].GetBoolean("https_listener",false); + if( ssl_listener) + { + cert_path = config.Configs["Network"].GetString("cert_path",String.Empty); + cert_pass = config.Configs["Network"].GetString("cert_pass",String.Empty); + https_port = (uint)config.Configs["Network"].GetInt("https_port", 0); + } } } } diff --git a/OpenSim/Framework/PriorityQueue.cs b/OpenSim/Framework/PriorityQueue.cs index 3e6fdaa7f9..e7a7f7f13c 100644 --- a/OpenSim/Framework/PriorityQueue.cs +++ b/OpenSim/Framework/PriorityQueue.cs @@ -38,7 +38,7 @@ namespace OpenSim.Framework { public class PriorityQueue { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public delegate bool UpdatePriorityHandler(ref uint priority, ISceneEntity entity); diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index db0f888a0a..7e3a4c53cb 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -96,251 +96,6 @@ namespace OpenSim.Framework } - [Serializable] - public class SimpleRegionInfo - { -// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - /// - /// The port by which http communication occurs with the region (most noticeably, CAPS communication) - /// - public uint HttpPort - { - get { return m_httpPort; } - set { m_httpPort = value; } - } - protected uint m_httpPort; - - /// - /// A well-formed URI for the host region server (namely "http://" + ExternalHostName) - /// - public string ServerURI - { - get { - if ( m_serverURI != string.Empty ) { - return m_serverURI; - } else { - return "http://" + m_externalHostName + ":" + m_httpPort + "/"; - } - } - set { - if ( value.EndsWith("/") ) { - m_serverURI = value; - } else { - m_serverURI = value + '/'; - } - } - } - protected string m_serverURI; - - public string RegionName - { - get { return m_regionName; } - set { m_regionName = value; } - } - protected string m_regionName = String.Empty; - - protected bool Allow_Alternate_Ports; - public bool m_allow_alternate_ports; - protected string m_externalHostName; - - protected IPEndPoint m_internalEndPoint; - protected uint? m_regionLocX; - protected uint? m_regionLocY; - protected uint m_remotingPort; - public UUID RegionID = UUID.Zero; - public string RemotingAddress; - public UUID ScopeID = UUID.Zero; - - public SimpleRegionInfo() - { - m_serverURI = string.Empty; - } - - public SimpleRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) - { - m_regionLocX = regionLocX; - m_regionLocY = regionLocY; - - m_internalEndPoint = internalEndPoint; - m_externalHostName = externalUri; - m_serverURI = string.Empty; - } - - public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, uint port) - { - m_regionLocX = regionLocX; - m_regionLocY = regionLocY; - - m_externalHostName = externalUri; - - m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port); - m_serverURI = string.Empty; - } - - public SimpleRegionInfo(RegionInfo ConvertFrom) - { - m_regionName = ConvertFrom.RegionName; - m_regionLocX = ConvertFrom.RegionLocX; - m_regionLocY = ConvertFrom.RegionLocY; - m_internalEndPoint = ConvertFrom.InternalEndPoint; - m_externalHostName = ConvertFrom.ExternalHostName; - m_remotingPort = ConvertFrom.RemotingPort; - m_httpPort = ConvertFrom.HttpPort; - m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports; - RemotingAddress = ConvertFrom.RemotingAddress; - RegionID = UUID.Zero; - ServerURI = ConvertFrom.ServerURI; - } - - public uint RemotingPort - { - get { return m_remotingPort; } - set { m_remotingPort = value; } - } - - /// - /// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw. - /// - /// XXX Isn't this really doing too much to be a simple getter, rather than an explict method? - /// - public IPEndPoint ExternalEndPoint - { - get - { - // Old one defaults to IPv6 - //return new IPEndPoint(Dns.GetHostAddresses(m_externalHostName)[0], m_internalEndPoint.Port); - - IPAddress ia = null; - // If it is already an IP, don't resolve it - just return directly - if (IPAddress.TryParse(m_externalHostName, out ia)) - return new IPEndPoint(ia, m_internalEndPoint.Port); - - // Reset for next check - ia = null; - try - { - foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName)) - { - if (ia == null) - ia = Adr; - - if (Adr.AddressFamily == AddressFamily.InterNetwork) - { - ia = Adr; - break; - } - } - } - catch (SocketException e) - { - throw new Exception( - "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" + - e + "' attached to this exception", e); - } - - return new IPEndPoint(ia, m_internalEndPoint.Port); - } - - set { m_externalHostName = value.ToString(); } - } - - public string ExternalHostName - { - get { return m_externalHostName; } - set { m_externalHostName = value; } - } - - public IPEndPoint InternalEndPoint - { - get { return m_internalEndPoint; } - set { m_internalEndPoint = value; } - } - - public uint RegionLocX - { - get { return m_regionLocX.Value; } - set { m_regionLocX = value; } - } - - public uint RegionLocY - { - get { return m_regionLocY.Value; } - set { m_regionLocY = value; } - } - - public ulong RegionHandle - { - get { return Util.UIntsToLong((RegionLocX * (uint) Constants.RegionSize), (RegionLocY * (uint) Constants.RegionSize)); } - } - - public int getInternalEndPointPort() - { - return m_internalEndPoint.Port; - } - - public Dictionary ToKeyValuePairs() - { - Dictionary kvp = new Dictionary(); - kvp["uuid"] = RegionID.ToString(); - kvp["locX"] = RegionLocX.ToString(); - kvp["locY"] = RegionLocY.ToString(); - kvp["external_ip_address"] = ExternalEndPoint.Address.ToString(); - kvp["external_port"] = ExternalEndPoint.Port.ToString(); - kvp["external_host_name"] = ExternalHostName; - kvp["http_port"] = HttpPort.ToString(); - kvp["internal_ip_address"] = InternalEndPoint.Address.ToString(); - kvp["internal_port"] = InternalEndPoint.Port.ToString(); - kvp["alternate_ports"] = m_allow_alternate_ports.ToString(); - kvp["server_uri"] = ServerURI; - - return kvp; - } - - public SimpleRegionInfo(Dictionary kvp) - { - if ((kvp["external_ip_address"] != null) && (kvp["external_port"] != null)) - { - int port = 0; - Int32.TryParse((string)kvp["external_port"], out port); - IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["external_ip_address"]), port); - ExternalEndPoint = ep; - } - else - ExternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); - - if (kvp["external_host_name"] != null) - ExternalHostName = (string)kvp["external_host_name"]; - - if (kvp["http_port"] != null) - { - UInt32 port = 0; - UInt32.TryParse((string)kvp["http_port"], out port); - HttpPort = port; - } - - if ((kvp["internal_ip_address"] != null) && (kvp["internal_port"] != null)) - { - int port = 0; - Int32.TryParse((string)kvp["internal_port"], out port); - IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["internal_ip_address"]), port); - InternalEndPoint = ep; - } - else - InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); - - if (kvp["alternate_ports"] != null) - { - bool alts = false; - Boolean.TryParse((string)kvp["alternate_ports"], out alts); - m_allow_alternate_ports = alts; - } - - if (kvp["server_uri"] != null) - ServerURI = (string)kvp["server_uri"]; - } - } - public class RegionInfo { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index ba89e2117b..598e5d17cd 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -32,6 +32,7 @@ using System.Collections.Specialized; using System.IO; using System.Net; using System.Net.Sockets; +using System.Security.Cryptography.X509Certificates; using System.Reflection; using System.Globalization; using System.Text; @@ -72,6 +73,7 @@ namespace OpenSim.Framework.Servers.HttpServer protected uint m_port; protected uint m_sslport; protected bool m_ssl; + private X509Certificate2 m_cert; protected bool m_firstcaps = true; protected string m_SSLCommonName = ""; @@ -123,6 +125,14 @@ namespace OpenSim.Framework.Servers.HttpServer } } + public BaseHttpServer(uint port, bool ssl, string CPath, string CPass) : this (port, ssl) + { + if (m_ssl) + { + m_cert = new X509Certificate2(CPath, CPass); + } + } + /// /// Add a stream handler to the http server. If the handler already exists, then nothing happens. /// @@ -1683,6 +1693,7 @@ namespace OpenSim.Framework.Servers.HttpServer try { //m_httpListener = new HttpListener(); + NotSocketErrors = 0; if (!m_ssl) { @@ -1702,6 +1713,9 @@ namespace OpenSim.Framework.Servers.HttpServer { //m_httpListener.Prefixes.Add("https://+:" + (m_sslport) + "/"); //m_httpListener.Prefixes.Add("http://+:" + m_port + "/"); + m_httpListener2 = CoolHTTPListener.Create(IPAddress.Any, (int)m_port, m_cert); + m_httpListener2.ExceptionThrown += httpServerException; + m_httpListener2.LogWriter = httpserverlog; } m_httpListener2.RequestReceived += OnRequest; diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 4734fc1f83..27a646aad1 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -31,6 +31,7 @@ using System.Collections.Generic; using System.Collections.Specialized; using System.Globalization; using System.IO; +using System.IO.Compression; using System.Net; using System.Net.Security; using System.Reflection; @@ -140,22 +141,32 @@ namespace OpenSim.Framework /// PUT JSON-encoded data to a web service that returns LLSD or /// JSON data /// + public static OSDMap PutToServiceCompressed(string url, OSDMap data, int timeout) + { + return ServiceOSDRequest(url,data, "PUT", timeout, true); + } + public static OSDMap PutToService(string url, OSDMap data, int timeout) { - return ServiceOSDRequest(url,data, "PUT", timeout); + return ServiceOSDRequest(url,data, "PUT", timeout, false); } public static OSDMap PostToService(string url, OSDMap data, int timeout) { - return ServiceOSDRequest(url, data, "POST", timeout); + return ServiceOSDRequest(url, data, "POST", timeout, false); + } + + public static OSDMap PostToServiceCompressed(string url, OSDMap data, int timeout) + { + return ServiceOSDRequest(url, data, "POST", timeout, true); } public static OSDMap GetFromService(string url, int timeout) { - return ServiceOSDRequest(url, null, "GET", timeout); + return ServiceOSDRequest(url, null, "GET", timeout, false); } - public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, int timeout) + public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, int timeout, bool compressed) { int reqnum = m_requestNumber++; // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); @@ -180,10 +191,31 @@ namespace OpenSim.Framework string strBuffer = OSDParser.SerializeJsonString(data); byte[] buffer = System.Text.Encoding.UTF8.GetBytes(strBuffer); - request.ContentType = "application/json"; - request.ContentLength = buffer.Length; //Count bytes to send - using (Stream requestStream = request.GetRequestStream()) - requestStream.Write(buffer, 0, buffer.Length); //Send it + if (compressed) + { + request.ContentType = "application/x-gzip"; + using (MemoryStream ms = new MemoryStream()) + { + using (GZipStream comp = new GZipStream(ms, CompressionMode.Compress)) + { + comp.Write(buffer, 0, buffer.Length); + // We need to close the gzip stream before we write it anywhere + // because apparently something important related to gzip compression + // gets written on the strteam upon Dispose() + } + byte[] buf = ms.ToArray(); + request.ContentLength = buf.Length; //Count bytes to send + using (Stream requestStream = request.GetRequestStream()) + requestStream.Write(buf, 0, (int)buf.Length); + } + } + else + { + request.ContentType = "application/json"; + request.ContentLength = buffer.Length; //Count bytes to send + using (Stream requestStream = request.GetRequestStream()) + requestStream.Write(buffer, 0, buffer.Length); //Send it + } } // capture how much time was spent writing, this may seem silly @@ -809,7 +841,7 @@ namespace OpenSim.Framework { if ((verb == "POST") || (verb == "PUT")) { - request.ContentType = "text/www-form-urlencoded"; + request.ContentType = "application/x-www-form-urlencoded"; int length = 0; using (StreamWriter writer = new StreamWriter(buffer)) @@ -886,6 +918,10 @@ namespace OpenSim.Framework public class SynchronousRestObjectRequester { + private static readonly ILog m_log = + LogManager.GetLogger( + MethodBase.GetCurrentMethod().DeclaringType); + /// /// Perform a synchronous REST request. /// @@ -929,8 +965,9 @@ namespace OpenSim.Framework requestStream = request.GetRequestStream(); requestStream.Write(buffer.ToArray(), 0, length); } - catch (Exception) + catch (Exception e) { + m_log.WarnFormat("[SynchronousRestObjectRequester]: exception in sending data to {0}: {1}", requestUrl, e); return deserial; } finally @@ -944,19 +981,28 @@ namespace OpenSim.Framework { using (WebResponse resp = request.GetResponse()) { - if (resp.ContentLength > 0) + if (resp.ContentLength != 0) { Stream respStream = resp.GetResponseStream(); XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); deserial = (TResponse)deserializer.Deserialize(respStream); respStream.Close(); } + else + m_log.WarnFormat("[SynchronousRestObjectRequester]: Oops! no content found in response stream from {0} {1}", requestUrl, verb); + } } catch (System.InvalidOperationException) { // This is what happens when there is invalid XML + m_log.WarnFormat("[SynchronousRestObjectRequester]: Invalid XML {0} {1}", requestUrl, typeof(TResponse).ToString()); } + catch (Exception e) + { + m_log.WarnFormat("[SynchronousRestObjectRequester]: Exception on response from {0} {1}", requestUrl, e); + } + return deserial; } } diff --git a/OpenSim/Region/Application/ConfigurationLoader.cs b/OpenSim/Region/Application/ConfigurationLoader.cs index 40ab76571e..2d81ea8432 100644 --- a/OpenSim/Region/Application/ConfigurationLoader.cs +++ b/OpenSim/Region/Application/ConfigurationLoader.cs @@ -372,21 +372,7 @@ namespace OpenSim = startupConfig.GetString("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll"); } - IConfig standaloneConfig = m_config.Source.Configs["StandAlone"]; - if (standaloneConfig != null) - { - m_configSettings.StandaloneAuthenticate = standaloneConfig.GetBoolean("accounts_authenticate", true); - m_configSettings.StandaloneWelcomeMessage = standaloneConfig.GetString("welcome_message"); - - m_configSettings.StandaloneInventoryPlugin = standaloneConfig.GetString("inventory_plugin"); - m_configSettings.StandaloneInventorySource = standaloneConfig.GetString("inventory_source"); - m_configSettings.StandaloneUserPlugin = standaloneConfig.GetString("userDatabase_plugin"); - m_configSettings.StandaloneUserSource = standaloneConfig.GetString("user_source"); - - m_configSettings.LibrariesXMLFile = standaloneConfig.GetString("LibrariesXMLFile"); - } - m_networkServersInfo.loadFromConfiguration(m_config.Source); } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index afde59ac3f..e0ece5b3f1 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -1436,7 +1436,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SendMapBlock(List mapBlocks, uint flag) { - MapBlockData[] mapBlocks2 = mapBlocks.ToArray(); int maxsend = 10; @@ -1686,14 +1685,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP currentPacket.ItemData[itemsSent % MAX_ITEMS_PER_PACKET] = CreateItemDataBlock(items[itemsSent++]); else { +// m_log.DebugFormat( +// "[LLCLIENTVIEW]: Sending inventory folder details packet to {0} for folder {1}", Name, folderID); OutPacket(currentPacket, ThrottleOutPacketType.Asset, false); currentPacket = null; } - } if (currentPacket != null) + { +// m_log.DebugFormat( +// "[LLCLIENTVIEW]: Sending inventory folder details packet to {0} for folder {1}", Name, folderID); OutPacket(currentPacket, ThrottleOutPacketType.Asset, false); + } } private InventoryDescendentsPacket.FolderDataBlock CreateFolderDataBlock(InventoryFolderBase folder) @@ -6087,7 +6091,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP AvatarWearingArgs wearingArgs = new AvatarWearingArgs(); for (int i = 0; i < nowWearing.WearableData.Length; i++) { - m_log.DebugFormat("[XXX]: Wearable type {0} item {1}", nowWearing.WearableData[i].WearableType, nowWearing.WearableData[i].ItemID); + //m_log.DebugFormat("[XXX]: Wearable type {0} item {1}", nowWearing.WearableData[i].WearableType, nowWearing.WearableData[i].ItemID); AvatarWearingArgs.Wearable wearable = new AvatarWearingArgs.Wearable(nowWearing.WearableData[i].ItemID, nowWearing.WearableData[i].WearableType); @@ -8369,13 +8373,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP return true; } #endregion - string mapName = Util.UTF8.GetString(map.NameData.Name, 0, map.NameData.Name.Length - 1); RequestMapName handlerMapNameRequest = OnMapNameRequest; if (handlerMapNameRequest != null) { - handlerMapNameRequest(this, mapName); + handlerMapNameRequest(this, mapName, map.AgentData.Flags); } return true; } diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index ea1317a19c..6e3a58e63a 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs @@ -96,6 +96,22 @@ namespace OpenSim.Region.ClientStack MainServer.Instance = m_httpServer; + // "OOB" Server + if (m_networkServersInfo.ssl_listener) + { + BaseHttpServer server = null; + server = new BaseHttpServer( + m_networkServersInfo.https_port, m_networkServersInfo.ssl_listener, m_networkServersInfo.cert_path, + m_networkServersInfo.cert_pass); + // Add the server to m_Servers + if(server != null) + { + m_log.InfoFormat("[REGION SERVER]: Starting HTTPS server on port {0}", server.Port); + MainServer.AddHttpServer(server); + server.Start(); + } + } + base.StartupSpecific(); } diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 787e7cef50..dc48fbd0d1 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -76,7 +76,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory } if (m_scene == null) - m_scene = scene; + m_scene = scene; } public void PostInitialise() @@ -162,12 +162,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory // one and we're done otherwise, ask for a rebake if (checkonly) return false; - m_log.InfoFormat("[AVFACTORY] missing baked texture {0}, request rebake",face.TextureID); + m_log.InfoFormat("[AVFACTORY]: missing baked texture {0}, requesting rebake",face.TextureID); client.SendRebakeAvatarTextures(face.TextureID); } } - m_log.DebugFormat("[AVFACTORY]: complete texture check for {0}", client.AgentId); + m_log.DebugFormat("[AVFACTORY]: completed texture check for {0}", client.AgentId); // If we only found default textures, then the appearance is not cached return (defonly ? false : true); diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index 919ea338f4..321b38b3a3 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs @@ -178,6 +178,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage List msglist = SynchronousRestObjectPoster.BeginPostObject>( "POST", m_RestURL + "/RetrieveMessages/", client.AgentId); + if (msglist == null) + m_log.WarnFormat("[OFFLINE MESSAGING]: WARNING null message list."); + foreach (GridInstantMessage im in msglist) { // client.SendInstantMessage(im); diff --git a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs index 111d80859c..eb776fe1bb 100644 --- a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs @@ -66,8 +66,8 @@ namespace OpenSim.Region.CoreModules.Framework m_scene = scene; m_scene.RegisterModuleInterface(this); MainConsole.Instance.Commands.AddCommand("Capabilities", false, "show caps", - "show capabilities", - "Shows all registered capabilities", CapabilitiesCommand); + "show caps", + "Shows all registered capabilities", CapabilitiesCommand); } public void RegionLoaded(Scene scene) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index ac67aa1c3b..d07eb23633 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -395,6 +395,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer return; } + sp.ControllingClient.SendTeleportProgress(teleportFlags | (uint)TeleportFlags.DisableCancel, "sending_dest"); + m_log.DebugFormat( "[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, sp.UUID); @@ -891,6 +893,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) { // region doesn't take it + ReInstantiateScripts(agent); ResetFromTransit(agent.UUID); return agent; } @@ -1763,14 +1766,22 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer protected void ReInstantiateScripts(ScenePresence sp) { int i = 0; - sp.Attachments.ForEach(delegate(SceneObjectGroup sog) + if (sp.InTransitScriptStates.Count > 0) { - sog.SetState(sp.InTransitScriptStates[i++], sp.Scene); - sog.CreateScriptInstances(0, false, sp.Scene.DefaultScriptEngine, 0); - sog.ResumeScripts(); - }); + sp.Attachments.ForEach(delegate(SceneObjectGroup sog) + { + if (i < sp.InTransitScriptStates.Count) + { + sog.SetState(sp.InTransitScriptStates[i++], sp.Scene); + sog.CreateScriptInstances(0, false, sp.Scene.DefaultScriptEngine, 0); + sog.ResumeScripts(); + } + else + m_log.ErrorFormat("[ENTITY TRANSFER MODULE]: InTransitScriptStates.Count={0} smaller than Attachments.Count={1}", sp.InTransitScriptStates.Count, sp.Attachments.Count); + }); - sp.InTransitScriptStates.Clear(); + sp.InTransitScriptStates.Clear(); + } } #endregion diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs index a0ccdc7276..5ab334ffaf 100644 --- a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs +++ b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs @@ -62,8 +62,8 @@ namespace OpenSim.Region.CoreModules.Hypergrid { List mapBlocks = new List(); List regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, - (minX - 4) * (int)Constants.RegionSize, (maxX + 4) * (int)Constants.RegionSize, - (minY - 4) * (int)Constants.RegionSize, (maxY + 4) * (int)Constants.RegionSize); + minX * (int)Constants.RegionSize, maxX * (int)Constants.RegionSize, + minY * (int)Constants.RegionSize, maxY * (int)Constants.RegionSize); foreach (GridRegion r in regions) { @@ -76,7 +76,7 @@ namespace OpenSim.Region.CoreModules.Hypergrid FillInMap(mapBlocks, minX, minY, maxX, maxY); // - remoteClient.SendMapBlock(mapBlocks, flag); + remoteClient.SendMapBlock(mapBlocks, 0); } @@ -93,7 +93,7 @@ namespace OpenSim.Region.CoreModules.Hypergrid mblock.X = (ushort)x; mblock.Y = (ushort)y; mblock.Name = ""; - mblock.Access = 254; // not here??? + mblock.Access = 254; // means 'simulator is offline'. We need this because the viewer ignores 255's mblock.MapImageId = UUID.Zero; mapBlocks.Add(mblock); } diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs index 4c8424d7cc..43672d114d 100644 --- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs @@ -118,7 +118,15 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest return true; } - return chain.Build(new X509Certificate2(certificate)); + if ((((int)sslPolicyErrors) & ~4) != 0) + return false; + + if (ServicePointManager.CertificatePolicy != null) + { + ServicePoint sp = Request.ServicePoint; + return ServicePointManager.CertificatePolicy.CheckValidationResult (sp, certificate, Request, 0); + } + return true; } #region IHttpRequestModule Members @@ -464,4 +472,4 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest } } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index 9b565ed85b..a552a28912 100644 --- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs @@ -78,7 +78,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp private int m_TotalUrls = 100; + private uint https_port = 0; private IHttpServer m_HttpServer = null; + private IHttpServer m_HttpsServer = null; private string m_ExternalHostNameForLSL = ""; @@ -100,6 +102,11 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp public void Initialise(IConfigSource config) { m_ExternalHostNameForLSL = config.Configs["Network"].GetString("ExternalHostNameForLSL", System.Environment.MachineName); + bool ssl_enabled = config.Configs["Network"].GetBoolean("https_listener",false); + if (ssl_enabled) + { + https_port = (uint) config.Configs["Network"].GetInt("https_port",0); + } } public void PostInitialise() @@ -113,6 +120,12 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp // There can only be one // m_HttpServer = MainServer.Instance; + // + // We can use the https if it is enabled + if (https_port > 0) + { + m_HttpsServer = MainServer.GetHttpServer(https_port); + } } scene.RegisterModuleInterface(this); @@ -171,7 +184,40 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp { UUID urlcode = UUID.Random(); - engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); + if (m_HttpsServer == null) + { + engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); + return urlcode; + } + + lock (m_UrlMap) + { + if (m_UrlMap.Count >= m_TotalUrls) + { + engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); + return urlcode; + } + string url = "https://" + m_ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + "/lslhttps/" + urlcode.ToString() + "/"; + + UrlData urlData = new UrlData(); + urlData.hostID = host.UUID; + urlData.itemID = itemID; + urlData.engine = engine; + urlData.url = url; + urlData.urlcode = urlcode; + urlData.requests = new Dictionary(); + + + m_UrlMap[url] = urlData; + + string uri = "/lslhttps/" + urlcode.ToString() + "/"; + + m_HttpsServer.AddPollServiceHTTPHandler(uri,HandleHttpPoll, + new PollServiceEventArgs(HttpRequestHandler,HasEvents, GetEvents, NoEvents, + urlcode)); + + engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_GRANTED", url }); + } return urlcode; } @@ -345,7 +391,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp } private Hashtable GetEvents(UUID requestID, UUID sessionID, string request) { - UrlData url = null; + UrlData url = null; RequestData requestData = null; lock (m_RequestMap) @@ -391,11 +437,12 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp lock (request) { string uri = request["uri"].ToString(); - + bool is_ssl = uri.Contains("lslhttps"); + try { Hashtable headers = (Hashtable)request["headers"]; - + // string uri_full = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri;// "/lslhttp/" + urlcode.ToString() + "/"; int pos1 = uri.IndexOf("/");// /lslhttp @@ -409,7 +456,11 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp pathInfo = uri.Substring(pos3); - UrlData url = m_UrlMap["http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri_tmp]; + UrlData url = null; + if (!is_ssl) + url = m_UrlMap["http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri_tmp]; + else + url = m_UrlMap["https://" + m_ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + uri_tmp]; //for llGetHttpHeader support we need to store original URI here //to make x-path-info / x-query-string / x-script-url / x-remote-ip headers diff --git a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs index ab6a598ace..e983239b4a 100644 --- a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs +++ b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs @@ -64,19 +64,26 @@ namespace OpenSim.Region.CoreModules.World.Region public void AddRegion(Scene scene) { m_Scene = scene; + scene.RegisterModuleInterface(this); MainConsole.Instance.Commands.AddCommand("RestartModule", false, "region restart bluebox", - "region restart bluebox