Merge branch 'master' into varregion

varregion
Robert Adams 2013-11-24 07:23:12 -08:00
commit 3193bcaae1
19 changed files with 9257 additions and 8624 deletions

7
.gitignore vendored
View File

@ -10,6 +10,12 @@
*.pidb
*.dll.build
*.dll
# Ignore .user and .suo files as these are user preference specific
# http://stackoverflow.com/questions/72298/should-i-add-the-visual-studio-suo-and-user-files-to-source-control
*.suo
*.user
*.VisualState.xml
*/*/obj
*/*/*/obj
@ -65,7 +71,6 @@ bin/crashes/
Examples/*.dll
OpenSim.build
OpenSim.sln
OpenSim.suo
OpenSim.userprefs
Prebuild/Prebuild.build
Prebuild/Prebuild.sln

View File

@ -28,6 +28,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Xml;
using System.Net;
@ -51,6 +52,7 @@ using OpenSim.Services.Interfaces;
using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo;
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using PermissionMask = OpenSim.Framework.PermissionMask;
using RegionInfo = OpenSim.Framework.RegionInfo;
namespace OpenSim.ApplicationPlugins.RemoteController
{
@ -145,6 +147,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
availableMethods["admin_create_user_email"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcCreateUserMethod);
availableMethods["admin_exists_user"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcUserExistsMethod);
availableMethods["admin_update_user"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcUpdateUserAccountMethod);
availableMethods["admin_authenticate_user"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcAuthenticateUserMethod);
// Region state management
availableMethods["admin_load_xml"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcLoadXMLMethod);
@ -1280,6 +1283,139 @@ namespace OpenSim.ApplicationPlugins.RemoteController
}
}
/// <summary>
/// Authenticate an user.
/// <summary>
/// <param name="request">incoming XML RPC request</param>
/// <remarks>
/// XmlRpcAuthenticateUserMethod takes the following XMLRPC
/// parameters
/// <list type="table">
/// <listheader><term>parameter name</term><description>description</description></listheader>
/// <item><term>password</term>
/// <description>admin password as set in OpenSim.ini</description></item>
/// <item><term>user_firstname</term>
/// <description>avatar's first name</description></item>
/// <item><term>user_lastname</term>
/// <description>avatar's last name</description></item>
/// <item><term>user_password</term>
/// <description>MD5 hash of avatar's password</description></item>
/// <item><term>token_lifetime</term>
/// <description>the lifetime of the returned token (upper bounded to 30s)</description></item>
/// </list>
///
/// XmlRpcAuthenticateUserMethod returns
/// <list type="table">
/// <listheader><term>name</term><description>description</description></listheader>
/// <item><term>success</term>
/// <description>true or false</description></item>
/// <item><term>token</term>
/// <description>the authentication token sent by OpenSim</description></item>
/// <item><term>error</term>
/// <description>error message if success is false</description></item>
/// </list>
/// </remarks>
private void XmlRpcAuthenticateUserMethod(XmlRpcRequest request, XmlRpcResponse response,
IPEndPoint remoteClient)
{
m_log.Info("[RADMIN]: AuthenticateUser: new request");
var responseData = (Hashtable)response.Value;
var requestData = (Hashtable)request.Params[0];
lock (m_requestLock)
{
try
{
CheckStringParameters(requestData, responseData, new[]
{
"user_firstname",
"user_lastname",
"user_password",
"token_lifetime"
});
var firstName = (string)requestData["user_firstname"];
var lastName = (string)requestData["user_lastname"];
var password = (string)requestData["user_password"];
var scene = m_application.SceneManager.CurrentOrFirstScene;
if (scene.Equals(null))
{
m_log.Debug("scene does not exist");
throw new Exception("Scene does not exist.");
}
var scopeID = scene.RegionInfo.ScopeID;
var account = scene.UserAccountService.GetUserAccount(scopeID, firstName, lastName);
if (account.Equals(null) || account.PrincipalID.Equals(UUID.Zero))
{
m_log.DebugFormat("avatar {0} {1} does not exist", firstName, lastName);
throw new Exception(String.Format("avatar {0} {1} does not exist", firstName, lastName));
}
if (String.IsNullOrEmpty(password))
{
m_log.DebugFormat("[RADMIN]: AuthenticateUser: no password provided for {0} {1}", firstName,
lastName);
throw new Exception(String.Format("no password provided for {0} {1}", firstName,
lastName));
}
int lifetime;
if (int.TryParse((string)requestData["token_lifetime"], NumberStyles.Integer, CultureInfo.InvariantCulture, out lifetime) == false)
{
m_log.DebugFormat("[RADMIN]: AuthenticateUser: no token lifetime provided for {0} {1}", firstName,
lastName);
throw new Exception(String.Format("no token lifetime provided for {0} {1}", firstName,
lastName));
}
// Upper bound on lifetime set to 30s.
if (lifetime > 30)
{
m_log.DebugFormat("[RADMIN]: AuthenticateUser: token lifetime longer than 30s for {0} {1}", firstName,
lastName);
throw new Exception(String.Format("token lifetime longer than 30s for {0} {1}", firstName,
lastName));
}
var authModule = scene.RequestModuleInterface<IAuthenticationService>();
if (authModule == null)
{
m_log.Debug("[RADMIN]: AuthenticateUser: no authentication module loded");
throw new Exception("no authentication module loaded");
}
var token = authModule.Authenticate(account.PrincipalID, password, lifetime);
if (String.IsNullOrEmpty(token))
{
m_log.DebugFormat("[RADMIN]: AuthenticateUser: authentication failed for {0} {1}", firstName,
lastName);
throw new Exception(String.Format("authentication failed for {0} {1}", firstName,
lastName));
}
m_log.DebugFormat("[RADMIN]: AuthenticateUser: account for user {0} {1} identified with token {2}",
firstName, lastName, token);
responseData["token"] = token;
responseData["success"] = true;
}
catch (Exception e)
{
responseData["success"] = false;
responseData["error"] = e.Message;
throw e;
}
m_log.Info("[RADMIN]: AuthenticateUser: request complete");
}
}
/// <summary>
/// Load an OAR file into a region..
/// <summary>

View File

@ -839,7 +839,7 @@ namespace OpenSim.Data.PGSQL
public void StoreRegionWindlightSettings(RegionLightShareData wl)
{
string sql = @"select count (region_id) from regionwindlight where ""region_id"" = :region_id ;";
string sql = @"select region_id from regionwindlight where ""region_id"" = :region_id limit 1;";
bool exists = false;
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
{
@ -847,7 +847,8 @@ namespace OpenSim.Data.PGSQL
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
{
cmd.Parameters.Add(_Database.CreateParameter("region_id", wl.regionID.ToString() ));
exists = cmd.ExecuteNonQuery() > 0;
NpgsqlDataReader dr = cmd.ExecuteReader();
exists = dr.Read();
}
}
if (exists)
@ -990,7 +991,7 @@ namespace OpenSim.Data.PGSQL
conn.Open();
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
{
cmd.Parameters.Add(_Database.CreateParameter("region_id", wl.regionID));
cmd.Parameters.Add(_Database.CreateParameter("region_id", wl.regionID.ToString()));
cmd.Parameters.Add(_Database.CreateParameter("water_color_r", wl.waterColor.X));
cmd.Parameters.Add(_Database.CreateParameter("water_color_g", wl.waterColor.Y));
cmd.Parameters.Add(_Database.CreateParameter("water_color_b", wl.waterColor.Z));
@ -1008,7 +1009,7 @@ namespace OpenSim.Data.PGSQL
cmd.Parameters.Add(_Database.CreateParameter("big_wave_direction_y", wl.bigWaveDirection.Y));
cmd.Parameters.Add(_Database.CreateParameter("little_wave_direction_x", wl.littleWaveDirection.X));
cmd.Parameters.Add(_Database.CreateParameter("little_wave_direction_y", wl.littleWaveDirection.Y));
cmd.Parameters.Add(_Database.CreateParameter("normal_map_texture", wl.normalMapTexture));
cmd.Parameters.Add(_Database.CreateParameter("normal_map_texture", wl.normalMapTexture.ToString()));
cmd.Parameters.Add(_Database.CreateParameter("horizon_r", wl.horizon.X));
cmd.Parameters.Add(_Database.CreateParameter("horizon_g", wl.horizon.Y));
cmd.Parameters.Add(_Database.CreateParameter("horizon_b", wl.horizon.Z));

View File

@ -128,7 +128,31 @@ namespace OpenSim.Framework
/// <summary>
/// Viewer's version string as reported by the viewer at login
/// </summary>
public string Viewer;
private string m_viewerInternal;
/// <summary>
/// Viewer's version string
/// </summary>
public string Viewer
{
set { m_viewerInternal = value; }
// Try to return consistent viewer string taking into account
// that viewers have chaagned how version is reported
// See http://opensimulator.org/mantis/view.php?id=6851
get
{
// Old style version string contains viewer name followed by a space followed by a version number
if (m_viewerInternal == null || m_viewerInternal.Contains(" "))
{
return m_viewerInternal;
}
else // New style version contains no spaces, just version number
{
return Channel + " " + m_viewerInternal;
}
}
}
/// <summary>
/// The channel strinf sent by the viewer at login

View File

@ -766,7 +766,7 @@ namespace OpenSim
foreach (IRegionModuleBase module in sharedModules.OrderBy(m => m.Name))
MainConsole.Instance.OutputFormat("New Region Module (Shared): {0}", module.Name);
foreach (IRegionModuleBase module in sharedModules.OrderBy(m => m.Name))
foreach (IRegionModuleBase module in nonSharedModules.OrderBy(m => m.Name))
MainConsole.Instance.OutputFormat("New Region Module (Non-Shared): {0}", module.Name);
}
);

View File

@ -321,7 +321,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
}
catch (Exception e)
{
UUID agentId = (sp.ControllingClient == null) ? (UUID)null : sp.ControllingClient.AgentId;
UUID agentId = (sp.ControllingClient == null) ? default(UUID) : sp.ControllingClient.AgentId;
m_log.ErrorFormat("[ATTACHMENTS MODULE]: Unable to rez attachment with itemID {0}, assetID {1}, point {2} for {3}: {4}\n{5}",
attach.ItemID, attach.AssetID, attachmentPt, agentId, e.Message, e.StackTrace);
}

View File

@ -152,7 +152,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
TestHelpers.InMethod();
string dtText
= "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World; Image http://localhost/shouldnotexist.png";
= "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World; Image http://0.0.0.0/shouldnotexist.png";
SetupScene(false);
SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene);
@ -307,7 +307,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
TestHelpers.InMethod();
string dtText
= "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World; Image http://localhost/shouldnotexist.png";
= "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World; Image http://0.0.0.0/shouldnotexist.png";
SetupScene(true);
SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene);

View File

@ -36,29 +36,212 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
{
public class LSL_EventTests : OpenSimTestCase
{
CSCodeGenerator m_cg = new CSCodeGenerator();
[Test]
public void TestBadEvent()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
TestCompile("default { bad() {} }", true);
}
[Test]
public void TestMovingEndEvent()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
TestVoidArgEvent("moving_end");
}
[Test]
public void TestMovingStartEvent()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
TestVoidArgEvent("moving_start");
}
[Test]
public void TestNoSensorEvent()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
TestVoidArgEvent("no_sensor");
}
[Test]
public void TestNotAtRotTargetEvent()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
TestVoidArgEvent("not_at_rot_target");
}
[Test]
public void TestNotAtTargetEvent()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
TestVoidArgEvent("not_at_target");
}
[Test]
public void TestStateEntryEvent()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
CSCodeGenerator cg = new CSCodeGenerator();
cg.Convert("default { state_entry() {} }");
TestVoidArgEvent("state_entry");
}
[Test]
public void TestStateExitEvent()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
TestVoidArgEvent("state_exit");
}
[Test]
public void TestTimerEvent()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
TestVoidArgEvent("timer");
}
private void TestVoidArgEvent(string eventName)
{
TestCompile("default { " + eventName + "() {} }", false);
TestCompile("default { " + eventName + "(integer n) {} }", true);
}
[Test]
public void TestChangedEvent()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
TestIntArgEvent("changed");
}
[Test]
public void TestCollisionEvent()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
TestIntArgEvent("collision");
}
[Test]
public void TestCollisionStartEvent()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
TestIntArgEvent("collision_start");
}
[Test]
public void TestCollisionEndEvent()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
TestIntArgEvent("collision_end");
}
[Test]
public void TestOnRezEvent()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
TestIntArgEvent("on_rez");
}
[Test]
public void TestRunTimePermissionsEvent()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
TestIntArgEvent("run_time_permissions");
}
[Test]
public void TestSensorEvent()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
TestIntArgEvent("sensor");
}
[Test]
public void TestTouchEvent()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
TestIntArgEvent("touch");
}
[Test]
public void TestTouchStartEvent()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
TestIntArgEvent("touch_start");
}
[Test]
public void TestTouchEndEvent()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
TestIntArgEvent("touch_end");
}
private void TestIntArgEvent(string eventName)
{
TestCompile("default { " + eventName + "(integer n) {} }", false);
TestCompile("default { " + eventName + "{{}} }", true);
TestCompile("default { " + eventName + "(string s) {{}} }", true);
TestCompile("default { " + eventName + "(integer n, integer o) {{}} }", true);
}
private void TestCompile(string script, bool expectException)
{
bool gotException = false;
Exception ge = null;
try
{
bool gotException = false;
try
{
cg.Convert("default { state_entry(integer n) {} }");
}
catch (Exception )
{
gotException = true;
}
Assert.That(gotException, Is.True);
m_cg.Convert(script);
}
catch (Exception e)
{
gotException = true;
ge = e;
}
Assert.That(
gotException,
Is.EqualTo(expectException),
"Failed on {0}, exception {1}", script, ge != null ? ge.ToString() : "n/a");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -213,16 +213,23 @@ namespace OpenSim.Services.HypergridService
// In the DB we tag it as type 100, but we use -1 (Unknown) outside
suitcase = CreateFolder(principalID, root.folderID, 100, "My Suitcase");
if (suitcase == null)
{
m_log.ErrorFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to create suitcase folder");
m_Database.StoreFolder(suitcase);
}
else
{
m_Database.StoreFolder(suitcase);
// Create System folders
CreateSystemFolders(principalID, suitcase.folderID);
// Create System folders
CreateSystemFolders(principalID, suitcase.folderID);
SetAsNormalFolder(suitcase);
return ConvertToOpenSim(suitcase);
}
}
SetAsNormalFolder(suitcase);
return ConvertToOpenSim(suitcase);
return null;
}
protected void CreateSystemFolders(UUID principalID, UUID rootID)

View File

@ -4,6 +4,7 @@
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
</configSections>
<runtime>
<loadFromRemoteSources enabled="true" />
<gcConcurrent enabled="true" />
<gcServer enabled="true" />
</runtime>

View File

@ -4,6 +4,7 @@
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
</configSections>
<runtime>
<loadFromRemoteSources enabled="true" />
<gcConcurrent enabled="true" />
<gcServer enabled="true" />
</runtime>

View File

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
</configSections>
<runtime>
<gcConcurrent enabled="true" />
<gcServer enabled="true" />
</runtime>
<appSettings>
</appSettings>
<log4net>
<appender name="Console" type="OpenSim.Framework.Console.OpenSimAppender, OpenSim.Framework.Console">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date{HH:mm:ss} - %message%newline" />
</layout>
</appender>
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
<file value="OpenSim.log" />
<appendToFile value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %-5level - %logger %message%newline" />
</layout>
</appender>
<root>
<level value="DEBUG" />
<appender-ref ref="Console" />
<appender-ref ref="LogFileAppender" />
</root>
</log4net>
</configuration>

View File

@ -4,6 +4,7 @@
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
</configSections>
<runtime>
<loadFromRemoteSources enabled="true" />
<gcConcurrent enabled="true" />
<gcServer enabled="true" />
</runtime>

View File

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
</configSections>
<appSettings>
</appSettings>
<log4net>
<appender name="Console" type="OpenSim.Framework.Console.OpenSimAppender, OpenSim.Framework.Console">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date{HH:mm:ss} - %message%newline" />
</layout>
</appender>
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
<file value="OpenSimExport.log" />
<appendToFile value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %-5level - %logger %message%newline" />
</layout>
</appender>
<root>
<level value="DEBUG" />
<appender-ref ref="Console" />
<appender-ref ref="LogFileAppender" />
</root>
</log4net>
</configuration>

View File

@ -4,6 +4,7 @@
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
</configSections>
<runtime>
<loadFromRemoteSources enabled="true" />
<gcConcurrent enabled="true" />
<gcServer enabled="true" />
</runtime>

View File

@ -4,6 +4,7 @@
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
</configSections>
<runtime>
<loadFromRemoteSources enabled="true" />
<gcConcurrent enabled="true" />
<gcServer enabled="true" />
</runtime>

View File

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
</configSections>
<appSettings>
</appSettings>
<log4net>
<appender name="Console" type="OpenSim.Framework.Console.OpenSimAppender, OpenSim.Framework.Console">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date{HH:mm:ss} - %message%newline" />
</layout>
</appender>
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
<file value="SimpleApp.log" />
<appendToFile value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %-5level - %logger %message%newline" />
</layout>
</appender>
<root>
<level value="DEBUG" />
<appender-ref ref="Console" />
<appender-ref ref="LogFileAppender" />
</root>
</log4net>
</configuration>

View File

@ -3,6 +3,9 @@
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
</configSections>
<runtime>
<loadFromRemoteSources enabled="true" />
</runtime>
<appSettings>
</appSettings>
<log4net>