*RemoteAdminPlugin can now be password protected. Add the password in the INI under [RemoteAdmin] with the name access_password
*Removed a few more unneeded exceptions in land that has been fixedafrisby
parent
9f3170b49f
commit
169e176f47
|
@ -53,7 +53,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
|||
{
|
||||
private OpenSimMain m_app;
|
||||
private BaseHttpServer m_httpd;
|
||||
|
||||
private string requiredPassword = "";
|
||||
public void Initialise(OpenSimMain openSim)
|
||||
{
|
||||
try
|
||||
|
@ -61,6 +61,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
|||
if (openSim.ConfigSource.Configs["RemoteAdmin"].GetBoolean("enabled", false))
|
||||
{
|
||||
MainLog.Instance.Verbose("RADMIN", "Remote Admin Plugin Enabled");
|
||||
requiredPassword = openSim.ConfigSource.Configs["RemoteAdmin"].GetString("access_password", "");
|
||||
|
||||
m_app = openSim;
|
||||
m_httpd = openSim.HttpServer;
|
||||
|
@ -85,19 +86,27 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
|||
LLUUID regionID = new LLUUID((string)requestData["regionID"]);
|
||||
|
||||
Hashtable responseData = new Hashtable();
|
||||
responseData["accepted"] = "true";
|
||||
response.Value = responseData;
|
||||
|
||||
OpenSim.Region.Environment.Scenes.Scene RebootedScene;
|
||||
|
||||
if (m_app.SceneManager.TryGetScene(regionID, out RebootedScene))
|
||||
if (requiredPassword != "" && (!requestData.Contains("password") || (string)requestData["password"] != requiredPassword))
|
||||
{
|
||||
responseData["rebooting"] = "true";
|
||||
RebootedScene.Restart(30);
|
||||
responseData["accepted"] = "false";
|
||||
response.Value = responseData;
|
||||
}
|
||||
else
|
||||
{
|
||||
responseData["rebooting"] = "false";
|
||||
responseData["accepted"] = "true";
|
||||
response.Value = responseData;
|
||||
|
||||
OpenSim.Region.Environment.Scenes.Scene RebootedScene;
|
||||
|
||||
if (m_app.SceneManager.TryGetScene(regionID, out RebootedScene))
|
||||
{
|
||||
responseData["rebooting"] = "true";
|
||||
RebootedScene.Restart(30);
|
||||
}
|
||||
else
|
||||
{
|
||||
responseData["rebooting"] = "false";
|
||||
}
|
||||
}
|
||||
|
||||
return response;
|
||||
|
@ -108,14 +117,23 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
|||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
|
||||
string message = (string)requestData["message"];
|
||||
MainLog.Instance.Verbose("RADMIN", "Broadcasting: " + message);
|
||||
|
||||
Hashtable responseData = new Hashtable();
|
||||
responseData["accepted"] = "true";
|
||||
response.Value = responseData;
|
||||
if (requiredPassword != "" && (!requestData.Contains("password") || (string)requestData["password"] != requiredPassword))
|
||||
{
|
||||
responseData["accepted"] = "false";
|
||||
response.Value = responseData;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
string message = (string)requestData["message"];
|
||||
MainLog.Instance.Verbose("RADMIN", "Broadcasting: " + message);
|
||||
|
||||
m_app.SceneManager.SendGeneralMessage(message);
|
||||
responseData["accepted"] = "true";
|
||||
response.Value = responseData;
|
||||
|
||||
m_app.SceneManager.SendGeneralMessage(message);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
@ -125,42 +143,49 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
|||
MainLog.Instance.Verbose("RADMIN", "Received Shutdown Administrator Request");
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
|
||||
if ((string)requestData["shutdown"] == "delayed")
|
||||
Hashtable responseData = new Hashtable();
|
||||
if (requiredPassword != "" && (!requestData.Contains("password") || (string)requestData["password"] != requiredPassword))
|
||||
{
|
||||
int timeout = (Int32)requestData["milliseconds"];
|
||||
|
||||
Hashtable responseData = new Hashtable();
|
||||
responseData["accepted"] = "true";
|
||||
responseData["accepted"] = "false";
|
||||
response.Value = responseData;
|
||||
|
||||
m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((int)(timeout / 1000)).ToString() +
|
||||
" second(s). Please save what you are doing and log out.");
|
||||
|
||||
// Perform shutdown
|
||||
Timer shutdownTimer = new Timer(timeout); // Wait before firing
|
||||
shutdownTimer.AutoReset = false;
|
||||
shutdownTimer.Elapsed += new ElapsedEventHandler(shutdownTimer_Elapsed);
|
||||
shutdownTimer.Start();
|
||||
|
||||
return response;
|
||||
}
|
||||
else
|
||||
{
|
||||
Hashtable responseData = new Hashtable();
|
||||
responseData["accepted"] = "true";
|
||||
response.Value = responseData;
|
||||
if ((string)requestData["shutdown"] == "delayed")
|
||||
{
|
||||
int timeout = (Int32)requestData["milliseconds"];
|
||||
|
||||
m_app.SceneManager.SendGeneralMessage("Region is going down now.");
|
||||
responseData["accepted"] = "true";
|
||||
response.Value = responseData;
|
||||
|
||||
// Perform shutdown
|
||||
Timer shutdownTimer = new Timer(2000); // Wait 2 seconds before firing
|
||||
shutdownTimer.AutoReset = false;
|
||||
shutdownTimer.Elapsed += new ElapsedEventHandler(shutdownTimer_Elapsed);
|
||||
shutdownTimer.Start();
|
||||
m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((int)(timeout / 1000)).ToString() +
|
||||
" second(s). Please save what you are doing and log out.");
|
||||
|
||||
return response;
|
||||
// Perform shutdown
|
||||
Timer shutdownTimer = new Timer(timeout); // Wait before firing
|
||||
shutdownTimer.AutoReset = false;
|
||||
shutdownTimer.Elapsed += new ElapsedEventHandler(shutdownTimer_Elapsed);
|
||||
shutdownTimer.Start();
|
||||
|
||||
return response;
|
||||
}
|
||||
else
|
||||
{
|
||||
responseData["accepted"] = "true";
|
||||
response.Value = responseData;
|
||||
|
||||
m_app.SceneManager.SendGeneralMessage("Region is going down now.");
|
||||
|
||||
// Perform shutdown
|
||||
Timer shutdownTimer = new Timer(2000); // Wait 2 seconds before firing
|
||||
shutdownTimer.AutoReset = false;
|
||||
shutdownTimer.Elapsed += new ElapsedEventHandler(shutdownTimer_Elapsed);
|
||||
shutdownTimer.Start();
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
private void shutdownTimer_Elapsed(object sender, ElapsedEventArgs e)
|
||||
|
@ -173,40 +198,46 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
|||
MainLog.Instance.Verbose("RADMIN", "Received Create Region Administrator Request");
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
|
||||
RegionInfo newRegionData = new RegionInfo();
|
||||
|
||||
try
|
||||
Hashtable responseData = new Hashtable();
|
||||
if (requiredPassword != "" && (!requestData.Contains("password") || (string)requestData["password"] != requiredPassword))
|
||||
{
|
||||
newRegionData.RegionID = (string)requestData["region_id"];
|
||||
newRegionData.RegionName = (string)requestData["region_name"];
|
||||
newRegionData.RegionLocX = Convert.ToUInt32((Int32)requestData["region_x"]);
|
||||
newRegionData.RegionLocY = Convert.ToUInt32((Int32)requestData["region_y"]);
|
||||
|
||||
// Security risk
|
||||
newRegionData.DataStore = (string)requestData["datastore"];
|
||||
|
||||
newRegionData.InternalEndPoint = new IPEndPoint(
|
||||
IPAddress.Parse((string)requestData["listen_ip"]), 0);
|
||||
|
||||
newRegionData.InternalEndPoint.Port = (Int32)requestData["listen_port"];
|
||||
newRegionData.ExternalHostName = (string)requestData["external_address"];
|
||||
|
||||
newRegionData.MasterAvatarFirstName = (string)requestData["region_master_first"];
|
||||
newRegionData.MasterAvatarLastName = (string)requestData["region_master_last"];
|
||||
|
||||
m_app.CreateRegion(newRegionData);
|
||||
|
||||
Hashtable responseData = new Hashtable();
|
||||
responseData["created"] = "true";
|
||||
responseData["created"] = "false";
|
||||
response.Value = responseData;
|
||||
}
|
||||
catch (Exception e)
|
||||
else
|
||||
{
|
||||
Hashtable responseData = new Hashtable();
|
||||
responseData["created"] = "false";
|
||||
responseData["error"] = e.ToString();
|
||||
response.Value = responseData;
|
||||
RegionInfo newRegionData = new RegionInfo();
|
||||
|
||||
try
|
||||
{
|
||||
newRegionData.RegionID = (string)requestData["region_id"];
|
||||
newRegionData.RegionName = (string)requestData["region_name"];
|
||||
newRegionData.RegionLocX = Convert.ToUInt32((Int32)requestData["region_x"]);
|
||||
newRegionData.RegionLocY = Convert.ToUInt32((Int32)requestData["region_y"]);
|
||||
|
||||
// Security risk
|
||||
newRegionData.DataStore = (string)requestData["datastore"];
|
||||
|
||||
newRegionData.InternalEndPoint = new IPEndPoint(
|
||||
IPAddress.Parse((string)requestData["listen_ip"]), 0);
|
||||
|
||||
newRegionData.InternalEndPoint.Port = (Int32)requestData["listen_port"];
|
||||
newRegionData.ExternalHostName = (string)requestData["external_address"];
|
||||
|
||||
newRegionData.MasterAvatarFirstName = (string)requestData["region_master_first"];
|
||||
newRegionData.MasterAvatarLastName = (string)requestData["region_master_last"];
|
||||
|
||||
m_app.CreateRegion(newRegionData);
|
||||
|
||||
responseData["created"] = "true";
|
||||
response.Value = responseData;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
responseData["created"] = "false";
|
||||
responseData["error"] = e.ToString();
|
||||
response.Value = responseData;
|
||||
}
|
||||
}
|
||||
|
||||
return response;
|
||||
|
|
|
@ -472,7 +472,7 @@ namespace OpenSim.Region.Environment.LandManagement
|
|||
if (bitmap.GetLength(0) != 64 || bitmap.GetLength(1) != 64 || bitmap.Rank != 2)
|
||||
{
|
||||
//Throw an exception - The bitmap is not 64x64
|
||||
throw new Exception("Error: Invalid Parcel Bitmap");
|
||||
//throw new Exception("Error: Invalid Parcel Bitmap");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -584,7 +584,7 @@ namespace OpenSim.Region.Environment.LandManagement
|
|||
if (land_bitmap.GetLength(0) != 64 || land_bitmap.GetLength(1) != 64 || land_bitmap.Rank != 2)
|
||||
{
|
||||
//Throw an exception - The bitmap is not 64x64
|
||||
throw new Exception("Error: Invalid Parcel Bitmap in modifyLandBitmapSquare()");
|
||||
//throw new Exception("Error: Invalid Parcel Bitmap in modifyLandBitmapSquare()");
|
||||
}
|
||||
|
||||
int x, y;
|
||||
|
|
Loading…
Reference in New Issue