Merge branch 'master' of ssh://diva@opensimulator.org/var/git/opensim

arthursv
Diva Canto 2009-08-17 13:27:22 -07:00
commit 59b4cf2d5b
10 changed files with 120 additions and 36 deletions

View File

@ -33,6 +33,7 @@ using System.IO;
using System.Net; using System.Net;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
using System.Web;
using HttpServer; using HttpServer;
using log4net; using log4net;
@ -72,6 +73,18 @@ namespace OpenSim.Framework.Servers.HttpServer
} }
private string _contentType; private string _contentType;
public HttpCookieCollection Cookies
{
get
{
RequestCookies cookies = _request.Cookies;
HttpCookieCollection httpCookies = new HttpCookieCollection();
foreach (RequestCookie cookie in cookies)
httpCookies.Add(new HttpCookie(cookie.Name, cookie.Value));
return httpCookies;
}
}
public bool HasEntityBody public bool HasEntityBody
{ {
get { return _request.ContentLength != 0; } get { return _request.ContentLength != 0; }

View File

@ -325,6 +325,8 @@ namespace OpenSim.Framework.Tests
{ {
//spurious litjson errors :P //spurious litjson errors :P
map2 = map; map2 = map;
Assert.That(1==1);
return;
} }
AgentCircuitData Agent2Data = new AgentCircuitData(); AgentCircuitData Agent2Data = new AgentCircuitData();

View File

@ -70,14 +70,14 @@ namespace OpenSim
protected bool m_autoCreateClientStack = true; protected bool m_autoCreateClientStack = true;
/// <summary> /// <value>
/// The file used to load and save prim backup xml if no filename has been specified /// The file used to load and save prim backup xml if no filename has been specified
/// </summary> /// </value>
protected const string DEFAULT_PRIM_BACKUP_FILENAME = "prim-backup.xml"; protected const string DEFAULT_PRIM_BACKUP_FILENAME = "prim-backup.xml";
/// <summary> /// <value>
/// The file used to load and save an opensimulator archive if no filename has been specified /// The file used to load and save an opensimulator archive if no filename has been specified
/// </summary> /// </value>
protected const string DEFAULT_OAR_BACKUP_FILENAME = "region.oar"; protected const string DEFAULT_OAR_BACKUP_FILENAME = "region.oar";
public ConfigSettings ConfigurationSettings public ConfigSettings ConfigurationSettings

View File

@ -83,6 +83,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
internal string _accessPassword = String.Empty; internal string _accessPassword = String.Empty;
internal Regex AccessPasswordRegex = null; internal Regex AccessPasswordRegex = null;
internal List<string> ExcludeList = new List<string>();
internal string AccessPassword internal string AccessPassword
{ {
get { return _accessPassword; } get { return _accessPassword; }
@ -210,7 +211,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
m_log.DebugFormat("[IRC-Channel-{0}] PingDelay : <{1}>", cs.idn, cs.PingDelay); m_log.DebugFormat("[IRC-Channel-{0}] PingDelay : <{1}>", cs.idn, cs.PingDelay);
cs.AccessPassword = Substitute(rs, config.GetString("access_password", cs.AccessPassword)); cs.AccessPassword = Substitute(rs, config.GetString("access_password", cs.AccessPassword));
m_log.DebugFormat("[IRC-Channel-{0}] AccessPassword : <{1}>", cs.idn, cs.AccessPassword); m_log.DebugFormat("[IRC-Channel-{0}] AccessPassword : <{1}>", cs.idn, cs.AccessPassword);
string[] excludes = config.GetString("exclude_list", "").Trim().Split(new Char[] { ',' });
cs.ExcludeList = new List<string>(excludes.Length);
foreach(string name in excludes)
{
cs.ExcludeList.Add(name.Trim().ToLower());
}
// Fail if fundamental information is still missing // Fail if fundamental information is still missing

View File

@ -145,8 +145,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
if (enabled && (cs.irc.Enabled) && (cs.irc.Connected) && (cs.ClientReporting)) if (enabled && (cs.irc.Enabled) && (cs.irc.Connected) && (cs.ClientReporting))
{ {
m_log.InfoFormat("[IRC-Region {0}]: {1} has left", Region, client.Name); m_log.InfoFormat("[IRC-Region {0}]: {1} has left", Region, client.Name);
//Check if this person is excluded from IRC
if (!cs.ExcludeList.Contains(client.Name.ToLower()))
{
cs.irc.PrivMsg(cs.NoticeMessageFormat, cs.irc.Nick, Region, String.Format("{0} has left", client.Name)); cs.irc.PrivMsg(cs.NoticeMessageFormat, cs.irc.Nick, Region, String.Format("{0} has left", client.Name));
} }
}
client.OnLogout -= OnClientLoggedOut; client.OnLogout -= OnClientLoggedOut;
client.OnConnectionClosed -= OnClientLoggedOut; client.OnConnectionClosed -= OnClientLoggedOut;
clients.Remove(client); clients.Remove(client);
@ -209,10 +213,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
{ {
string clientName = String.Format("{0} {1}", presence.Firstname, presence.Lastname); string clientName = String.Format("{0} {1}", presence.Firstname, presence.Lastname);
m_log.DebugFormat("[IRC-Region {0}] {1} has arrived", Region, clientName); m_log.DebugFormat("[IRC-Region {0}] {1} has arrived", Region, clientName);
//Check if this person is excluded from IRC
if (!cs.ExcludeList.Contains(clientName.ToLower()))
{
cs.irc.PrivMsg(cs.NoticeMessageFormat, cs.irc.Nick, Region, String.Format("{0} has arrived", clientName)); cs.irc.PrivMsg(cs.NoticeMessageFormat, cs.irc.Nick, Region, String.Format("{0} has arrived", clientName));
} }
} }
} }
}
catch (Exception ex) catch (Exception ex)
{ {
m_log.ErrorFormat("[IRC-Region {0}]: MakeRootAgent exception: {1}", Region, ex.Message); m_log.ErrorFormat("[IRC-Region {0}]: MakeRootAgent exception: {1}", Region, ex.Message);

View File

@ -211,25 +211,39 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{ {
if (script.StartsWith("//MRM:C#")) if (script.StartsWith("//MRM:C#"))
{ {
if (m_config.GetBoolean("OwnerOnly", true))
if (m_scene.GetSceneObjectPart(localID).OwnerID != m_scene.RegionInfo.MasterAvatarAssignedUUID if (m_scene.GetSceneObjectPart(localID).OwnerID != m_scene.RegionInfo.MasterAvatarAssignedUUID
|| || m_scene.GetSceneObjectPart(localID).CreatorID != m_scene.RegionInfo.MasterAvatarAssignedUUID)
m_scene.GetSceneObjectPart(localID).CreatorID != m_scene.RegionInfo.MasterAvatarAssignedUUID)
return; return;
script = ConvertMRMKeywords(script); script = ConvertMRMKeywords(script);
try try
{ {
m_log.Info("[MRM] Found C# MRM - Starting in AppDomain with " + m_config.GetString("permissionLevel", "Internet") + "-level security."); AppDomain target;
if (m_config.GetBoolean("Sandboxed", true))
{
m_log.Info("[MRM] Found C# MRM - Starting in AppDomain with " +
m_config.GetString("SandboxLevel", "Internet") + "-level security.");
string domainName = UUID.Random().ToString(); string domainName = UUID.Random().ToString();
AppDomain target = CreateRestrictedDomain(m_config.GetString("permissionLevel", "Internet"), target = CreateRestrictedDomain(m_config.GetString("SandboxLevel", "Internet"),
domainName); domainName);
}
else
{
m_log.Info("[MRM] Found C# MRM - Starting in current AppDomain");
m_log.Warn(
"[MRM] Security Risk: AppDomain is run in current context. Use only in trusted environments.");
target = AppDomain.CurrentDomain;
}
m_log.Info("[MRM] Unwrapping into target AppDomain");
MRMBase mmb = (MRMBase) target.CreateInstanceFromAndUnwrap( MRMBase mmb = (MRMBase) target.CreateInstanceFromAndUnwrap(
CompileFromDotNetText(script, itemID.ToString()), CompileFromDotNetText(script, itemID.ToString()),
"OpenSim.MiniModule"); "OpenSim.MiniModule");
m_log.Info("[MRM] Initialising MRM Globals");
InitializeMRM(mmb, localID, itemID); InitializeMRM(mmb, localID, itemID);
m_scripts[itemID] = mmb; m_scripts[itemID] = mmb;

View File

@ -91,24 +91,45 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
public bool Bright public bool Bright
{ {
get { return GetTexface().Fullbright; } get { return GetTexface().Fullbright; }
set { throw new System.NotImplementedException(); } set
{
Primitive.TextureEntry tex = m_parent.Shape.Textures;
Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face);
texface.Fullbright = value;
tex.FaceTextures[m_face] = texface;
m_parent.UpdateTexture(tex);
}
} }
public double Bloom public double Bloom
{ {
get { return GetTexface().Glow; } get { return GetTexface().Glow; }
set { throw new System.NotImplementedException(); } set
{
Primitive.TextureEntry tex = m_parent.Shape.Textures;
Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face);
texface.Glow = (float) value;
tex.FaceTextures[m_face] = texface;
m_parent.UpdateTexture(tex);
}
} }
public bool Shiny public bool Shiny
{ {
get { return GetTexface().Shiny != Shininess.None; } get { return GetTexface().Shiny != Shininess.None; }
set { throw new System.NotImplementedException(); } set
{
Primitive.TextureEntry tex = m_parent.Shape.Textures;
Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face);
texface.Shiny = value ? Shininess.High : Shininess.None;
tex.FaceTextures[m_face] = texface;
m_parent.UpdateTexture(tex);
}
} }
public bool BumpMap public bool BumpMap
{ {
get { throw new System.NotImplementedException(); } get { return GetTexface().Bump == Bumpiness.None; }
set { throw new System.NotImplementedException(); } set { throw new System.NotImplementedException(); }
} }
} }

View File

@ -25,17 +25,13 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
using System;
using System.Reflection;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Security;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using log4net;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{ {
class SPAvatar : System.MarshalByRefObject, IAvatar class SPAvatar : System.MarshalByRefObject, IAvatar
@ -60,7 +56,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
public string Name public string Name
{ {
get { return GetSP().Name; } get { return GetSP().Name; }
set { throw new InvalidOperationException("Avatar Names are a read-only property."); } set { throw new SecurityException("Avatar Names are a read-only property."); }
} }
public UUID GlobalID public UUID GlobalID

View File

@ -679,15 +679,20 @@
;relay_chat = true ;relay_chat = true
;access_password = foobar ;access_password = foobar
;fallback_region = name of "default" region ;;fallback_region = name of "default" region
;MSGformat fields : 0=botnick, 1=user, 2=region, 3=message ;;MSGformat fields : 0=botnick, 1=user, 2=region, 3=message
; must start with "PRIVMSG {0} : " or irc server will get upset ;; must start with "PRIVMSG {0} : " or irc server will get upset
;for <bot>:<user in region> :<message> ;;for <bot>:<user in region> :<message>
;msgformat = "PRIVMSG {0} :<{1} in {2}>: {3}" ;;msgformat = "PRIVMSG {0} :<{1} in {2}>: {3}"
;for <bot>:<message> - <user of region> : ;;for <bot>:<message> - <user of region> :
msgformat = "PRIVMSG {0} : {3} - {1} of {2}" ;msgformat = "PRIVMSG {0} : {3} - {1} of {2}"
;for <bot>:<message> - from <user> : ;;for <bot>:<message> - from <user> :
;msgformat = "PRIVMSG {0} : {3} - from {1}" ;;msgformat = "PRIVMSG {0} : {3} - from {1}"
;; exclude_list allows you to stop the IRC connector from announcing the
;;arrival and departure of certain users. For example: admins, bots.
;exclude_list=User 1,User 2,User 3
;[CMS] ;[CMS]
@ -1163,10 +1168,28 @@
[MRM] [MRM]
; Enables the Mini Region Modules Script Engine. WARNING: SECURITY RISK. ; Enables the Mini Region Modules Script Engine.
; default is false ; default is false
Enabled = false Enabled = false
; Runs MRM in a Security Sandbox
; WARNING: DISABLING IS A SECURITY RISK.
Sandboxed = true
; The level sandbox to use, adjust at your OWN RISK.
; Valid values are:
; * FullTrust
; * SkipVerification
; * Execution
; * Nothing
; * LocalIntranet
; * Internet
; * Everything
SandboxLevel = "Internet"
; Only allow Region Owners to run MRMs
; May represent a security risk if you disable this.
OwnerOnly = true
[Hypergrid] [Hypergrid]
; Keep it false for now. Making it true requires the use of a special client in order to access inventory ; Keep it false for now. Making it true requires the use of a special client in order to access inventory

View File

@ -70,6 +70,7 @@
<ReferencePath>../../../../bin/</ReferencePath> <ReferencePath>../../../../bin/</ReferencePath>
<Reference name="System"/> <Reference name="System"/>
<Reference name="System.Xml"/> <Reference name="System.Xml"/>
<Reference name="System.Web"/>
<Reference name="OpenMetaverse.StructuredData.dll"/> <Reference name="OpenMetaverse.StructuredData.dll"/>
<Reference name="OpenMetaverseTypes.dll"/> <Reference name="OpenMetaverseTypes.dll"/>
<Reference name="XMLRPC.dll"/> <Reference name="XMLRPC.dll"/>