aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs50
1 files changed, 29 insertions, 21 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index b8ee3ee..2cb5375 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -58,7 +58,8 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
58 { 58 {
59 try 59 try
60 { 60 {
61 if (openSim.ConfigSource.Configs["RemoteAdmin"] != null && openSim.ConfigSource.Configs["RemoteAdmin"].GetBoolean("enabled", false)) 61 if (openSim.ConfigSource.Configs["RemoteAdmin"] != null &&
62 openSim.ConfigSource.Configs["RemoteAdmin"].GetBoolean("enabled", false))
62 { 63 {
63 m_log.Info("[RADMIN]: Remote Admin Plugin Enabled"); 64 m_log.Info("[RADMIN]: Remote Admin Plugin Enabled");
64 requiredPassword = openSim.ConfigSource.Configs["RemoteAdmin"].GetString("access_password", String.Empty); 65 requiredPassword = openSim.ConfigSource.Configs["RemoteAdmin"].GetString("access_password", String.Empty);
@@ -86,34 +87,38 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
86 XmlRpcResponse response = new XmlRpcResponse(); 87 XmlRpcResponse response = new XmlRpcResponse();
87 Hashtable requestData = (Hashtable) request.Params[0]; 88 Hashtable requestData = (Hashtable) request.Params[0];
88 89
89 LLUUID regionID = new LLUUID((string) requestData["regionID"]);
90
91 Hashtable responseData = new Hashtable(); 90 Hashtable responseData = new Hashtable();
92 91
93 m_log.Info("[RADMIN]: Request to restart Region."); 92 m_log.Info("[RADMIN]: Request to restart Region.");
93 try {
94 checkStringParameters(request, new string[] { "password", "regionID" });
95
96 if (requiredPassword != String.Empty &&
97 (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword))
98 throw new Exception("wrong password");
99
100 LLUUID regionID = new LLUUID((string) requestData["regionID"]);
94 101
95 if (requiredPassword != String.Empty &&
96 (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword))
97 {
98 responseData["accepted"] = "false";
99 response.Value = responseData;
100 }
101 else
102 {
103 responseData["accepted"] = "true"; 102 responseData["accepted"] = "true";
104 response.Value = responseData; 103 response.Value = responseData;
105 104
106 Scene RebootedScene; 105 Scene rebootedScene;
107 106
108 if (m_app.SceneManager.TryGetScene(regionID, out RebootedScene)) 107 if (!m_app.SceneManager.TryGetScene(regionID, out rebootedScene))
109 { 108 throw new Exception("region not found");
110 responseData["rebooting"] = "true"; 109
111 RebootedScene.Restart(30); 110 responseData["rebooting"] = "true";
112 } 111 rebootedScene.Restart(30);
113 else 112 }
114 { 113 catch(Exception e)
115 responseData["rebooting"] = "false"; 114 {
116 } 115 m_log.ErrorFormat("[RADMIN]: Restart region: failed: {0}", e.Message);
116 m_log.DebugFormat("[RADMIN]: Restart region: failed: {0}", e.ToString());
117 responseData["accepted"] = "false";
118 responseData["success"] = "false";
119 responseData["rebooting"] = "false";
120 responseData["error"] = e.Message;
121 response.Value = responseData;
117 } 122 }
118 123
119 return response; 124 return response;
@@ -144,7 +149,10 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
144 { 149 {
145 m_log.ErrorFormat("[RADMIN]: Broadcasting: failed: {0}", e.Message); 150 m_log.ErrorFormat("[RADMIN]: Broadcasting: failed: {0}", e.Message);
146 m_log.DebugFormat("[RADMIN]: Broadcasting: failed: {0}", e.ToString()); 151 m_log.DebugFormat("[RADMIN]: Broadcasting: failed: {0}", e.ToString());
152
147 responseData["accepted"] = "false"; 153 responseData["accepted"] = "false";
154 responseData["success"] = "false";
155 responseData["error"] = e.Message;
148 response.Value = responseData; 156 response.Value = responseData;
149 } 157 }
150 158