diff --git a/OpenSim/Data/PGSQL/PGSQLFramework.cs b/OpenSim/Data/PGSQL/PGSQLFramework.cs index 494b0aad8f..48f8dd379f 100644 --- a/OpenSim/Data/PGSQL/PGSQLFramework.cs +++ b/OpenSim/Data/PGSQL/PGSQLFramework.cs @@ -29,6 +29,7 @@ using System; using System.Collections; using System.Collections.Generic; using System.Data; +using System.Reflection; using OpenMetaverse; using OpenSim.Framework; using Npgsql; @@ -50,8 +51,30 @@ namespace OpenSim.Data.PGSQL protected PGSqlFramework(string connectionString) { m_connectionString = connectionString; + InitializeMonoSecurity(); } + public void InitializeMonoSecurity() + { + if (!Util.IsPlatformMono) + { + AppDomain currentDomain = AppDomain.CurrentDomain; + currentDomain.AssemblyResolve += new ResolveEventHandler(ResolveEventHandlerMonoSec); + } + } + + private System.Reflection.Assembly ResolveEventHandlerMonoSec(object sender, ResolveEventArgs args) + { + Assembly MyAssembly = null; + + if (args.Name.Substring(0, args.Name.IndexOf(",")) == "Mono.Security") + { + MyAssembly = Assembly.LoadFrom("lib/NET/Mono.Security.dll"); + } + + //Return the loaded assembly. + return MyAssembly; + } ////////////////////////////////////////////////////////////// // // All non queries are funneled through one connection diff --git a/OpenSim/Data/PGSQL/PGSQLManager.cs b/OpenSim/Data/PGSQL/PGSQLManager.cs index 3ddaf38693..2084fe9ce8 100644 --- a/OpenSim/Data/PGSQL/PGSQLManager.cs +++ b/OpenSim/Data/PGSQL/PGSQLManager.cs @@ -30,6 +30,7 @@ using System.Collections.Generic; using System.Data; using System.IO; using System.Reflection; +using OpenSim.Framework; using log4net; using OpenMetaverse; using Npgsql; @@ -56,6 +57,29 @@ namespace OpenSim.Data.PGSQL public PGSQLManager(string connection) { connectionString = connection; + InitializeMonoSecurity(); + } + + public void InitializeMonoSecurity() + { + if (!Util.IsPlatformMono) + { + AppDomain currentDomain = AppDomain.CurrentDomain; + currentDomain.AssemblyResolve += new ResolveEventHandler(ResolveEventHandlerMonoSec); + } + } + + private System.Reflection.Assembly ResolveEventHandlerMonoSec(object sender, ResolveEventArgs args) + { + Assembly MyAssembly = null; + + if (args.Name.Substring(0, args.Name.IndexOf(",")) == "Mono.Security") + { + MyAssembly = Assembly.LoadFrom("lib/NET/Mono.Security.dll"); + } + + //Return the loaded assembly. + return MyAssembly; } /// diff --git a/bin/lib/NET/Mono.Security.dll b/bin/lib/NET/Mono.Security.dll new file mode 100644 index 0000000000..6accde7911 Binary files /dev/null and b/bin/lib/NET/Mono.Security.dll differ