From: Dr Scofield <hud@zurich.ibm.com>
attached patch does a bit of reformatting and adds some more parameter checking to RemoteAdmin.0.6.0-stable
parent
1fb54b074c
commit
78ae258bb0
|
@ -58,7 +58,8 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (openSim.ConfigSource.Configs["RemoteAdmin"] != null && openSim.ConfigSource.Configs["RemoteAdmin"].GetBoolean("enabled", false))
|
if (openSim.ConfigSource.Configs["RemoteAdmin"] != null &&
|
||||||
|
openSim.ConfigSource.Configs["RemoteAdmin"].GetBoolean("enabled", false))
|
||||||
{
|
{
|
||||||
m_log.Info("[RADMIN]: Remote Admin Plugin Enabled");
|
m_log.Info("[RADMIN]: Remote Admin Plugin Enabled");
|
||||||
requiredPassword = openSim.ConfigSource.Configs["RemoteAdmin"].GetString("access_password", String.Empty);
|
requiredPassword = openSim.ConfigSource.Configs["RemoteAdmin"].GetString("access_password", String.Empty);
|
||||||
|
@ -86,34 +87,38 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
||||||
XmlRpcResponse response = new XmlRpcResponse();
|
XmlRpcResponse response = new XmlRpcResponse();
|
||||||
Hashtable requestData = (Hashtable) request.Params[0];
|
Hashtable requestData = (Hashtable) request.Params[0];
|
||||||
|
|
||||||
LLUUID regionID = new LLUUID((string) requestData["regionID"]);
|
|
||||||
|
|
||||||
Hashtable responseData = new Hashtable();
|
Hashtable responseData = new Hashtable();
|
||||||
|
|
||||||
m_log.Info("[RADMIN]: Request to restart Region.");
|
m_log.Info("[RADMIN]: Request to restart Region.");
|
||||||
|
try {
|
||||||
|
checkStringParameters(request, new string[] { "password", "regionID" });
|
||||||
|
|
||||||
|
if (requiredPassword != String.Empty &&
|
||||||
|
(!requestData.Contains("password") || (string) requestData["password"] != requiredPassword))
|
||||||
|
throw new Exception("wrong password");
|
||||||
|
|
||||||
|
LLUUID regionID = new LLUUID((string) requestData["regionID"]);
|
||||||
|
|
||||||
if (requiredPassword != String.Empty &&
|
|
||||||
(!requestData.Contains("password") || (string) requestData["password"] != requiredPassword))
|
|
||||||
{
|
|
||||||
responseData["accepted"] = "false";
|
|
||||||
response.Value = responseData;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
responseData["accepted"] = "true";
|
responseData["accepted"] = "true";
|
||||||
response.Value = responseData;
|
response.Value = responseData;
|
||||||
|
|
||||||
Scene RebootedScene;
|
Scene rebootedScene;
|
||||||
|
|
||||||
if (m_app.SceneManager.TryGetScene(regionID, out RebootedScene))
|
if (!m_app.SceneManager.TryGetScene(regionID, out rebootedScene))
|
||||||
{
|
throw new Exception("region not found");
|
||||||
responseData["rebooting"] = "true";
|
|
||||||
RebootedScene.Restart(30);
|
responseData["rebooting"] = "true";
|
||||||
}
|
rebootedScene.Restart(30);
|
||||||
else
|
}
|
||||||
{
|
catch(Exception e)
|
||||||
responseData["rebooting"] = "false";
|
{
|
||||||
}
|
m_log.ErrorFormat("[RADMIN]: Restart region: failed: {0}", e.Message);
|
||||||
|
m_log.DebugFormat("[RADMIN]: Restart region: failed: {0}", e.ToString());
|
||||||
|
responseData["accepted"] = "false";
|
||||||
|
responseData["success"] = "false";
|
||||||
|
responseData["rebooting"] = "false";
|
||||||
|
responseData["error"] = e.Message;
|
||||||
|
response.Value = responseData;
|
||||||
}
|
}
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
|
@ -144,7 +149,10 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[RADMIN]: Broadcasting: failed: {0}", e.Message);
|
m_log.ErrorFormat("[RADMIN]: Broadcasting: failed: {0}", e.Message);
|
||||||
m_log.DebugFormat("[RADMIN]: Broadcasting: failed: {0}", e.ToString());
|
m_log.DebugFormat("[RADMIN]: Broadcasting: failed: {0}", e.ToString());
|
||||||
|
|
||||||
responseData["accepted"] = "false";
|
responseData["accepted"] = "false";
|
||||||
|
responseData["success"] = "false";
|
||||||
|
responseData["error"] = e.Message;
|
||||||
response.Value = responseData;
|
response.Value = responseData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue