From b3a6f8d688fa68d45cde43d81c1e7607e4f7cf57 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Tue, 26 Aug 2008 05:20:46 +0000 Subject: [PATCH] * Workaround for application/llsd+xml requests coming in as application/xml * When OGP is active, disable SSL certificate chain validation. I'll add more options here to come, as well as a way to test against a group of known certificate subjects. --- OpenSim/Framework/Servers/BaseHttpServer.cs | 48 +++++++++++++++++++ .../InterGrid/OpenGridProtocolModule.cs | 20 ++++++++ 2 files changed, 68 insertions(+) diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index 7b2b599be6..13c5752cd8 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs @@ -272,6 +272,13 @@ namespace OpenSim.Framework.Servers case "text/xml": case "application/xml": default: + if (DoWeHaveALLSDHandler(request.RawUrl)) + { + m_log.ErrorFormat("[BASE HTTP SERVER]: Potentially incorrect content type on Registered LLSD CAP: Content Type:{0}", request.ContentType); + HandleLLSDRequests(request, response); + + return; + } HandleXmlRpcRequests(request, response); return; } @@ -532,6 +539,47 @@ namespace OpenSim.Framework.Servers } } + private bool DoWeHaveALLSDHandler(string path) + { + + string[] pathbase = path.Split('/'); + string searchquery = "/"; + + if (pathbase.Length < 1) + return false; + + for (int i = 1; i < pathbase.Length; i++) + { + searchquery += pathbase[i]; + if (pathbase.Length - 1 != i) + searchquery += "/"; + } + + string bestMatch = null; + + foreach (string pattern in m_llsdHandlers.Keys) + { + if (searchquery.StartsWith(searchquery)) + { + if (String.IsNullOrEmpty(bestMatch) || searchquery.Length > bestMatch.Length) + { + bestMatch = pattern; + } + } + } + + if (String.IsNullOrEmpty(bestMatch)) + { + + return false; + } + else + { + + return true; + } + } + private bool TryGetLLSDHandler(string path, out LLSDMethod llsdHandler) { llsdHandler = null; diff --git a/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs index e2a46a1026..5874d9bc15 100644 --- a/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs +++ b/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs @@ -30,6 +30,7 @@ using System.Collections.Generic; using System.IO; using System.Net; using System.Net.Security; +using System.Security.Cryptography.X509Certificates; using System.Net.Sockets; using System.Reflection; using System.Text.RegularExpressions; @@ -113,6 +114,7 @@ namespace OpenSim.Region.Environment.Modules.InterGrid if (m_scene.Count == 0) { scene.AddLLSDHandler("/agent/", ProcessAgentDomainMessage); + ServicePointManager.ServerCertificateValidationCallback += customXertificateValidation; } if (!m_scene.Contains(scene)) @@ -585,10 +587,12 @@ namespace OpenSim.Region.Environment.Modules.InterGrid private LLSDMap invokeRezAvatarCap(LLSDMap responseMap, string CapAddress, OGPState userState) { + WebRequest DeRezRequest = WebRequest.Create(CapAddress); DeRezRequest.Method = "POST"; DeRezRequest.ContentType = "application/xml+llsd"; + LLSDMap RAMap = new LLSDMap(); LLSDMap AgentParms = new LLSDMap(); @@ -842,6 +846,22 @@ namespace OpenSim.Region.Environment.Modules.InterGrid ta.Start(); } } + // Temporary hack to allow teleporting to and from Vaak + private static bool customXertificateValidation(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors error) + { + + //if (cert.Subject == "E=root@lindenlab.com, CN=*.vaak.lindenlab.com, O=\"Linden Lab, Inc.\", L=San Francisco, S=California, C=US") + //{ + + return true; + + //} + + //return false; + + } + + } public class KillAUser