diff options
author | Adam Frisby | 2008-05-01 18:04:42 +0000 |
---|---|---|
committer | Adam Frisby | 2008-05-01 18:04:42 +0000 |
commit | 20a9bf08f51351e1e0a9de94f184ff56cd572665 (patch) | |
tree | 52da64dab26353b903c8e4befed0178fa72a188b /OpenSim/ApplicationPlugins | |
parent | More config cleanup in LaunchSLClient. (diff) | |
download | opensim-SC-20a9bf08f51351e1e0a9de94f184ff56cd572665.zip opensim-SC-20a9bf08f51351e1e0a9de94f184ff56cd572665.tar.gz opensim-SC-20a9bf08f51351e1e0a9de94f184ff56cd572665.tar.bz2 opensim-SC-20a9bf08f51351e1e0a9de94f184ff56cd572665.tar.xz |
* Rolled back a few changes.
Diffstat (limited to 'OpenSim/ApplicationPlugins')
-rw-r--r-- | OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs | 4 | ||||
-rw-r--r-- | OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | 216 |
2 files changed, 102 insertions, 118 deletions
diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs index 7e498d6..dd3f4b3 100644 --- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs +++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs | |||
@@ -68,7 +68,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
68 | 68 | ||
69 | for (int i = 0; i < regionsToLoad.Length; i++) | 69 | for (int i = 0; i < regionsToLoad.Length; i++) |
70 | { | 70 | { |
71 | m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " + Thread.CurrentThread.ManagedThreadId + | 71 | m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " + Thread.CurrentThread.ManagedThreadId.ToString() + |
72 | ")"); | 72 | ")"); |
73 | openSim.CreateRegion(regionsToLoad[i], true); | 73 | openSim.CreateRegion(regionsToLoad[i], true); |
74 | } | 74 | } |
@@ -106,7 +106,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
106 | if (regionhandle == regionsToLoad[i].RegionHandle) | 106 | if (regionhandle == regionsToLoad[i].RegionHandle) |
107 | { | 107 | { |
108 | m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " + | 108 | m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " + |
109 | Thread.CurrentThread.ManagedThreadId + ")"); | 109 | Thread.CurrentThread.ManagedThreadId.ToString() + ")"); |
110 | openSim.CreateRegion(regionsToLoad[i], true); | 110 | openSim.CreateRegion(regionsToLoad[i], true); |
111 | } | 111 | } |
112 | } | 112 | } |
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index b7067e7..e540e4d 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -54,13 +54,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
54 | private BaseHttpServer m_httpd; | 54 | private BaseHttpServer m_httpd; |
55 | private string requiredPassword = String.Empty; | 55 | private string requiredPassword = String.Empty; |
56 | 56 | ||
57 | #region IApplicationPlugin Members | ||
58 | |||
59 | public void Initialise(OpenSimMain openSim) | 57 | public void Initialise(OpenSimMain openSim) |
60 | { | 58 | { |
61 | try | 59 | try |
62 | { | 60 | { |
63 | if (openSim.ConfigSource.Configs["RemoteAdmin"] != null && | 61 | if (openSim.ConfigSource.Configs["RemoteAdmin"] != null && |
64 | openSim.ConfigSource.Configs["RemoteAdmin"].GetBoolean("enabled", false)) | 62 | openSim.ConfigSource.Configs["RemoteAdmin"].GetBoolean("enabled", false)) |
65 | { | 63 | { |
66 | m_log.Info("[RADMIN]: Remote Admin Plugin Enabled"); | 64 | m_log.Info("[RADMIN]: Remote Admin Plugin Enabled"); |
@@ -84,12 +82,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
84 | } | 82 | } |
85 | } | 83 | } |
86 | 84 | ||
87 | public void Close() | ||
88 | { | ||
89 | } | ||
90 | |||
91 | #endregion | ||
92 | |||
93 | public XmlRpcResponse XmlRpcRestartMethod(XmlRpcRequest request) | 85 | public XmlRpcResponse XmlRpcRestartMethod(XmlRpcRequest request) |
94 | { | 86 | { |
95 | XmlRpcResponse response = new XmlRpcResponse(); | 87 | XmlRpcResponse response = new XmlRpcResponse(); |
@@ -98,14 +90,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
98 | Hashtable responseData = new Hashtable(); | 90 | Hashtable responseData = new Hashtable(); |
99 | 91 | ||
100 | m_log.Info("[RADMIN]: Request to restart Region."); | 92 | m_log.Info("[RADMIN]: Request to restart Region."); |
101 | try | 93 | try { |
102 | { | 94 | checkStringParameters(request, new string[] { "password", "regionID" }); |
103 | checkStringParameters(request, new[] {"password", "regionID"}); | ||
104 | 95 | ||
105 | if (requiredPassword != String.Empty && | 96 | if (requiredPassword != String.Empty && |
106 | (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword)) | 97 | (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword)) |
107 | throw new Exception("wrong password"); | 98 | throw new Exception("wrong password"); |
108 | 99 | ||
109 | LLUUID regionID = new LLUUID((string) requestData["regionID"]); | 100 | LLUUID regionID = new LLUUID((string) requestData["regionID"]); |
110 | 101 | ||
111 | responseData["accepted"] = "true"; | 102 | responseData["accepted"] = "true"; |
@@ -115,11 +106,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
115 | 106 | ||
116 | if (!m_app.SceneManager.TryGetScene(regionID, out rebootedScene)) | 107 | if (!m_app.SceneManager.TryGetScene(regionID, out rebootedScene)) |
117 | throw new Exception("region not found"); | 108 | throw new Exception("region not found"); |
118 | 109 | ||
119 | responseData["rebooting"] = "true"; | 110 | responseData["rebooting"] = "true"; |
120 | rebootedScene.Restart(30); | 111 | rebootedScene.Restart(30); |
121 | } | 112 | } |
122 | catch (Exception e) | 113 | catch(Exception e) |
123 | { | 114 | { |
124 | m_log.ErrorFormat("[RADMIN]: Restart region: failed: {0}", e.Message); | 115 | m_log.ErrorFormat("[RADMIN]: Restart region: failed: {0}", e.Message); |
125 | m_log.DebugFormat("[RADMIN]: Restart region: failed: {0}", e.ToString()); | 116 | m_log.DebugFormat("[RADMIN]: Restart region: failed: {0}", e.ToString()); |
@@ -139,14 +130,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
139 | Hashtable requestData = (Hashtable) request.Params[0]; | 130 | Hashtable requestData = (Hashtable) request.Params[0]; |
140 | Hashtable responseData = new Hashtable(); | 131 | Hashtable responseData = new Hashtable(); |
141 | 132 | ||
142 | try | 133 | try { |
143 | { | 134 | checkStringParameters(request, new string[] { "password", "message" }); |
144 | checkStringParameters(request, new[] {"password", "message"}); | ||
145 | 135 | ||
146 | if (requiredPassword != String.Empty && | 136 | if (requiredPassword != String.Empty && |
147 | (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword)) | 137 | (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword)) |
148 | throw new Exception("wrong password"); | 138 | throw new Exception("wrong password"); |
149 | 139 | ||
150 | string message = (string) requestData["message"]; | 140 | string message = (string) requestData["message"]; |
151 | m_log.InfoFormat("[RADMIN]: Broadcasting: {0}", message); | 141 | m_log.InfoFormat("[RADMIN]: Broadcasting: {0}", message); |
152 | 142 | ||
@@ -155,7 +145,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
155 | 145 | ||
156 | m_app.SceneManager.SendGeneralMessage(message); | 146 | m_app.SceneManager.SendGeneralMessage(message); |
157 | } | 147 | } |
158 | catch (Exception e) | 148 | catch(Exception e) |
159 | { | 149 | { |
160 | m_log.ErrorFormat("[RADMIN]: Broadcasting: failed: {0}", e.Message); | 150 | m_log.ErrorFormat("[RADMIN]: Broadcasting: failed: {0}", e.Message); |
161 | m_log.DebugFormat("[RADMIN]: Broadcasting: failed: {0}", e.ToString()); | 151 | m_log.DebugFormat("[RADMIN]: Broadcasting: failed: {0}", e.ToString()); |
@@ -172,25 +162,24 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
172 | public XmlRpcResponse XmlRpcLoadHeightmapMethod(XmlRpcRequest request) | 162 | public XmlRpcResponse XmlRpcLoadHeightmapMethod(XmlRpcRequest request) |
173 | { | 163 | { |
174 | XmlRpcResponse response = new XmlRpcResponse(); | 164 | XmlRpcResponse response = new XmlRpcResponse(); |
175 | Hashtable requestData = (Hashtable) request.Params[0]; | 165 | Hashtable requestData = (Hashtable)request.Params[0]; |
176 | 166 | ||
177 | m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}", request.ToString()); | 167 | m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}", request.ToString()); |
178 | foreach (string k in requestData.Keys) | 168 | foreach (string k in requestData.Keys) |
179 | { | 169 | { |
180 | m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}: >{1}< {2}", | 170 | m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}: >{1}< {2}", |
181 | k, requestData[k], ((string) requestData[k]).Length); | 171 | k, (string)requestData[k], ((string)requestData[k]).Length); |
182 | } | 172 | } |
183 | 173 | ||
184 | Hashtable responseData = new Hashtable(); | 174 | Hashtable responseData = new Hashtable(); |
185 | try | 175 | try { |
186 | { | 176 | checkStringParameters(request, new string[] { "password", "filename", "regionid"}); |
187 | checkStringParameters(request, new[] {"password", "filename", "regionid"}); | ||
188 | 177 | ||
189 | if (requiredPassword != String.Empty && | 178 | if (requiredPassword != String.Empty && |
190 | (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword)) | 179 | (!requestData.Contains("password") || (string)requestData["password"] != requiredPassword)) |
191 | throw new Exception("wrong password"); | 180 | throw new Exception("wrong password"); |
192 | 181 | ||
193 | string file = (string) requestData["filename"]; | 182 | string file = (string)requestData["filename"]; |
194 | LLUUID regionID = (string) requestData["regionid"]; | 183 | LLUUID regionID = (string) requestData["regionid"]; |
195 | m_log.InfoFormat("[RADMIN]: Terrain Loading: {0}", file); | 184 | m_log.InfoFormat("[RADMIN]: Terrain Loading: {0}", file); |
196 | 185 | ||
@@ -209,7 +198,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
209 | 198 | ||
210 | response.Value = responseData; | 199 | response.Value = responseData; |
211 | } | 200 | } |
212 | catch (Exception e) | 201 | catch (Exception e) |
213 | { | 202 | { |
214 | m_log.ErrorFormat("[RADMIN] Terrain Loading: failed: {0}", e.Message); | 203 | m_log.ErrorFormat("[RADMIN] Terrain Loading: failed: {0}", e.Message); |
215 | m_log.DebugFormat("[RADMIN] Terrain Loading: failed: {0}", e.ToString()); | 204 | m_log.DebugFormat("[RADMIN] Terrain Loading: failed: {0}", e.ToString()); |
@@ -228,8 +217,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
228 | Hashtable requestData = (Hashtable) request.Params[0]; | 217 | Hashtable requestData = (Hashtable) request.Params[0]; |
229 | Hashtable responseData = new Hashtable(); | 218 | Hashtable responseData = new Hashtable(); |
230 | 219 | ||
231 | try | 220 | try { |
232 | { | ||
233 | if (requiredPassword != String.Empty && | 221 | if (requiredPassword != String.Empty && |
234 | (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword)) | 222 | (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword)) |
235 | throw new Exception("wrong password"); | 223 | throw new Exception("wrong password"); |
@@ -239,14 +227,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
239 | 227 | ||
240 | int timeout = 2000; | 228 | int timeout = 2000; |
241 | 229 | ||
242 | if (requestData.ContainsKey("shutdown") && | 230 | if (requestData.ContainsKey("shutdown") && |
243 | ((string) requestData["shutdown"] == "delayed") && | 231 | ((string) requestData["shutdown"] == "delayed") && |
244 | requestData.ContainsKey("milliseconds")) | 232 | requestData.ContainsKey("milliseconds")) |
245 | { | 233 | { |
246 | timeout = (Int32) requestData["milliseconds"]; | 234 | timeout = (Int32) requestData["milliseconds"]; |
247 | m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((timeout / 1000)) + | 235 | m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((int) (timeout/1000)).ToString() + |
248 | " second(s). Please save what you are doing and log out."); | 236 | " second(s). Please save what you are doing and log out."); |
249 | } | 237 | } |
250 | else | 238 | else |
251 | { | 239 | { |
252 | m_app.SceneManager.SendGeneralMessage("Region is going down now."); | 240 | m_app.SceneManager.SendGeneralMessage("Region is going down now."); |
@@ -255,12 +243,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
255 | // Perform shutdown | 243 | // Perform shutdown |
256 | Timer shutdownTimer = new Timer(timeout); // Wait before firing | 244 | Timer shutdownTimer = new Timer(timeout); // Wait before firing |
257 | shutdownTimer.AutoReset = false; | 245 | shutdownTimer.AutoReset = false; |
258 | shutdownTimer.Elapsed += shutdownTimer_Elapsed; | 246 | shutdownTimer.Elapsed += new ElapsedEventHandler(shutdownTimer_Elapsed); |
259 | shutdownTimer.Start(); | 247 | shutdownTimer.Start(); |
260 | 248 | ||
261 | responseData["success"] = "true"; | 249 | responseData["success"] = "true"; |
262 | } | 250 | } |
263 | catch (Exception e) | 251 | catch (Exception e) |
264 | { | 252 | { |
265 | m_log.ErrorFormat("[RADMIN] Shutdown: failed: {0}", e.Message); | 253 | m_log.ErrorFormat("[RADMIN] Shutdown: failed: {0}", e.Message); |
266 | m_log.DebugFormat("[RADMIN] Shutdown: failed: {0}", e.ToString()); | 254 | m_log.DebugFormat("[RADMIN] Shutdown: failed: {0}", e.ToString()); |
@@ -284,9 +272,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
284 | Hashtable requestData = (Hashtable) request.Params[0]; | 272 | Hashtable requestData = (Hashtable) request.Params[0]; |
285 | foreach (string p in param) | 273 | foreach (string p in param) |
286 | { | 274 | { |
287 | if (!requestData.Contains(p)) | 275 | if (!requestData.Contains(p)) |
288 | throw new Exception(String.Format("missing string parameter {0}", p)); | 276 | throw new Exception(String.Format("missing string parameter {0}", p)); |
289 | if (String.IsNullOrEmpty((string) requestData[p])) | 277 | if (String.IsNullOrEmpty((string)requestData[p])) |
290 | throw new Exception(String.Format("parameter {0} is empty", p)); | 278 | throw new Exception(String.Format("parameter {0} is empty", p)); |
291 | } | 279 | } |
292 | } | 280 | } |
@@ -296,7 +284,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
296 | Hashtable requestData = (Hashtable) request.Params[0]; | 284 | Hashtable requestData = (Hashtable) request.Params[0]; |
297 | foreach (string p in param) | 285 | foreach (string p in param) |
298 | { | 286 | { |
299 | if (!requestData.Contains(p)) | 287 | if (!requestData.Contains(p)) |
300 | throw new Exception(String.Format("missing integer parameter {0}", p)); | 288 | throw new Exception(String.Format("missing integer parameter {0}", p)); |
301 | } | 289 | } |
302 | } | 290 | } |
@@ -357,35 +345,31 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
357 | Hashtable requestData = (Hashtable) request.Params[0]; | 345 | Hashtable requestData = (Hashtable) request.Params[0]; |
358 | Hashtable responseData = new Hashtable(); | 346 | Hashtable responseData = new Hashtable(); |
359 | 347 | ||
360 | try | 348 | try { |
361 | { | 349 | checkStringParameters(request, new string[] { "password", |
362 | checkStringParameters(request, new[] | 350 | "region_name", |
363 | { | 351 | "region_master_first", "region_master_last", |
364 | "password", | 352 | "region_master_password", |
365 | "region_name", | 353 | "listen_ip", "external_address"}); |
366 | "region_master_first", "region_master_last", | 354 | checkIntegerParams(request, new string[] { "region_x", "region_y", "listen_port"}); |
367 | "region_master_password", | ||
368 | "listen_ip", "external_address" | ||
369 | }); | ||
370 | checkIntegerParams(request, new[] {"region_x", "region_y", "listen_port"}); | ||
371 | 355 | ||
372 | // check password | 356 | // check password |
373 | if (!String.IsNullOrEmpty(requiredPassword) && | 357 | if (!String.IsNullOrEmpty(requiredPassword) && |
374 | (string) requestData["password"] != requiredPassword) throw new Exception("wrong password"); | 358 | (string)requestData["password"] != requiredPassword) throw new Exception("wrong password"); |
375 | 359 | ||
376 | // extract or generate region ID now | 360 | // extract or generate region ID now |
377 | Scene scene = null; | 361 | Scene scene = null; |
378 | LLUUID regionID = LLUUID.Zero; | 362 | LLUUID regionID = LLUUID.Zero; |
379 | if (requestData.ContainsKey("region_id") && | 363 | if (requestData.ContainsKey("region_id") && |
380 | !String.IsNullOrEmpty((string) requestData["region_id"])) | 364 | !String.IsNullOrEmpty((string)requestData["region_id"])) |
381 | { | 365 | { |
382 | regionID = (string) requestData["region_id"]; | 366 | regionID = (string) requestData["region_id"]; |
383 | if (m_app.SceneManager.TryGetScene(regionID, out scene)) | 367 | if (m_app.SceneManager.TryGetScene(regionID, out scene)) |
384 | throw new Exception(String.Format("region UUID already in use by region {0}, UUID {1}, <{2},{3}>", | 368 | throw new Exception(String.Format("region UUID already in use by region {0}, UUID {1}, <{2},{3}>", |
385 | scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, | 369 | scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, |
386 | scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY)); | 370 | scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY)); |
387 | } | 371 | } |
388 | else | 372 | else |
389 | { | 373 | { |
390 | regionID = LLUUID.Random(); | 374 | regionID = LLUUID.Random(); |
391 | m_log.DebugFormat("[RADMIN] CreateRegion: new region UUID {0}", regionID); | 375 | m_log.DebugFormat("[RADMIN] CreateRegion: new region UUID {0}", regionID); |
@@ -401,7 +385,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
401 | 385 | ||
402 | // check for collisions: region name, region UUID, | 386 | // check for collisions: region name, region UUID, |
403 | // region location | 387 | // region location |
404 | if (m_app.SceneManager.TryGetScene(region.RegionName, out scene)) | 388 | if (m_app.SceneManager.TryGetScene(region.RegionName, out scene)) |
405 | throw new Exception(String.Format("region name already in use by region {0}, UUID {1}, <{2},{3}>", | 389 | throw new Exception(String.Format("region name already in use by region {0}, UUID {1}, <{2},{3}>", |
406 | scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, | 390 | scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, |
407 | scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY)); | 391 | scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY)); |
@@ -411,46 +395,46 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
411 | region.RegionLocX, region.RegionLocY, | 395 | region.RegionLocX, region.RegionLocY, |
412 | scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, | 396 | scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, |
413 | scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY)); | 397 | scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY)); |
414 | 398 | ||
415 | // Security risk [and apparently not used] | 399 | // Security risk [and apparently not used] |
416 | // if (requestData.ContainsKey("datastore")) | 400 | // if (requestData.ContainsKey("datastore")) |
417 | // region.DataStore = (string) requestData["datastore"]; | 401 | // region.DataStore = (string) requestData["datastore"]; |
418 | 402 | ||
419 | region.InternalEndPoint = | 403 | region.InternalEndPoint = |
420 | new IPEndPoint(IPAddress.Parse((string) requestData["listen_ip"]), 0); | 404 | new IPEndPoint(IPAddress.Parse((string) requestData["listen_ip"]), 0); |
421 | 405 | ||
422 | region.InternalEndPoint.Port = (Int32) requestData["listen_port"]; | 406 | region.InternalEndPoint.Port = (Int32) requestData["listen_port"]; |
423 | if (0 == region.InternalEndPoint.Port) throw new Exception("listen_port is 0"); | 407 | if (0 == region.InternalEndPoint.Port) throw new Exception("listen_port is 0"); |
424 | if (m_app.SceneManager.TryGetScene(region.InternalEndPoint, out scene)) | 408 | if (m_app.SceneManager.TryGetScene(region.InternalEndPoint, out scene)) |
425 | throw new Exception(String.Format("region internal IP {0} and port {1} already in use by region {2}, UUID {3}, <{4},{5}>", | 409 | throw new Exception(String.Format("region internal IP {0} and port {1} already in use by region {2}, UUID {3}, <{4},{5}>", |
426 | region.InternalEndPoint.Address, | 410 | region.InternalEndPoint.Address, |
427 | region.InternalEndPoint.Port, | 411 | region.InternalEndPoint.Port, |
428 | scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, | 412 | scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, |
429 | scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY)); | 413 | scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY)); |
430 | 414 | ||
431 | 415 | ||
432 | region.ExternalHostName = (string) requestData["external_address"]; | 416 | region.ExternalHostName = (string) requestData["external_address"]; |
433 | 417 | ||
434 | region.MasterAvatarFirstName = (string) requestData["region_master_first"]; | 418 | region.MasterAvatarFirstName = (string) requestData["region_master_first"]; |
435 | region.MasterAvatarLastName = (string) requestData["region_master_last"]; | 419 | region.MasterAvatarLastName = (string) requestData["region_master_last"]; |
436 | region.MasterAvatarSandboxPassword = (string) requestData["region_master_password"]; | 420 | region.MasterAvatarSandboxPassword = (string) requestData["region_master_password"]; |
437 | 421 | ||
438 | bool persist = Convert.ToBoolean((string) requestData["persist"]); | 422 | bool persist = Convert.ToBoolean((string)requestData["persist"]); |
439 | if (persist) | 423 | if (persist) |
440 | { | 424 | { |
441 | string regionConfigPath = Path.Combine(Path.Combine(Util.configDir(), "Regions"), | 425 | string regionConfigPath = Path.Combine(Path.Combine(Util.configDir(), "Regions"), |
442 | String.Format("{0}x{1}-{2}.xml", | 426 | String.Format("{0}x{1}-{2}.xml", |
443 | region.RegionLocX, | 427 | region.RegionLocX.ToString(), |
444 | region.RegionLocY, | 428 | region.RegionLocY.ToString(), |
445 | regionID)); | 429 | regionID.ToString())); |
446 | m_log.DebugFormat("[RADMIN] CreateRegion: persisting region {0} to {1}", | 430 | m_log.DebugFormat("[RADMIN] CreateRegion: persisting region {0} to {1}", |
447 | region.RegionID, regionConfigPath); | 431 | region.RegionID, regionConfigPath); |
448 | region.SaveRegionToFile("dynamic region", regionConfigPath); | 432 | region.SaveRegionToFile("dynamic region", regionConfigPath); |
449 | } | 433 | } |
450 | 434 | ||
451 | m_app.CreateRegion(region); | 435 | m_app.CreateRegion(region); |
452 | 436 | ||
453 | responseData["success"] = "true"; | 437 | responseData["success"] = "true"; |
454 | responseData["region_name"] = region.RegionName; | 438 | responseData["region_name"] = region.RegionName; |
455 | responseData["region_uuid"] = region.RegionID.ToString(); | 439 | responseData["region_uuid"] = region.RegionID.ToString(); |
456 | 440 | ||
@@ -513,52 +497,48 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
513 | Hashtable requestData = (Hashtable) request.Params[0]; | 497 | Hashtable requestData = (Hashtable) request.Params[0]; |
514 | Hashtable responseData = new Hashtable(); | 498 | Hashtable responseData = new Hashtable(); |
515 | 499 | ||
516 | try | 500 | try |
517 | { | 501 | { |
518 | // check completeness | 502 | // check completeness |
519 | checkStringParameters(request, new[] | 503 | checkStringParameters(request, new string[] { "password", "user_firstname", |
520 | { | 504 | "user_lastname", "user_password" }); |
521 | "password", "user_firstname", | 505 | checkIntegerParams(request, new string[] { "start_region_x", "start_region_y" }); |
522 | "user_lastname", "user_password" | ||
523 | }); | ||
524 | checkIntegerParams(request, new[] {"start_region_x", "start_region_y"}); | ||
525 | 506 | ||
526 | // check password | 507 | // check password |
527 | if (!String.IsNullOrEmpty(requiredPassword) && | 508 | if (!String.IsNullOrEmpty(requiredPassword) && |
528 | (string) requestData["password"] != requiredPassword) throw new Exception("wrong password"); | 509 | (string)requestData["password"] != requiredPassword) throw new Exception("wrong password"); |
529 | 510 | ||
530 | // do the job | 511 | // do the job |
531 | string firstname = (string) requestData["user_firstname"]; | 512 | string firstname = (string) requestData["user_firstname"]; |
532 | string lastname = (string) requestData["user_lastname"]; | 513 | string lastname = (string) requestData["user_lastname"]; |
533 | string passwd = (string) requestData["user_password"]; | 514 | string passwd = (string) requestData["user_password"]; |
534 | uint regX = Convert.ToUInt32((Int32) requestData["start_region_x"]); | 515 | uint regX = Convert.ToUInt32((Int32)requestData["start_region_x"]); |
535 | uint regY = Convert.ToUInt32((Int32) requestData["start_region_y"]); | 516 | uint regY = Convert.ToUInt32((Int32)requestData["start_region_y"]); |
536 | 517 | ||
537 | UserProfileData userProfile = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname); | 518 | UserProfileData userProfile = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname); |
538 | if (null != userProfile) | 519 | if (null != userProfile) |
539 | throw new Exception(String.Format("avatar {0} {1} already exists", firstname, lastname)); | 520 | throw new Exception(String.Format("avatar {0} {1} already exists", firstname, lastname)); |
540 | 521 | ||
541 | LLUUID userID = m_app.CreateUser(firstname, lastname, passwd, regX, regY); | 522 | LLUUID userID = m_app.CreateUser(firstname, lastname, passwd, regX, regY); |
542 | 523 | ||
543 | if (userID == LLUUID.Zero) | 524 | if (userID == LLUUID.Zero) throw new Exception(String.Format("failed to create new user {0} {1}", |
544 | throw new Exception(String.Format("failed to create new user {0} {1}", | 525 | firstname, lastname)); |
545 | firstname, lastname)); | 526 | |
546 | 527 | responseData["success"] = "true"; | |
547 | responseData["success"] = "true"; | ||
548 | responseData["avatar_uuid"] = userID.ToString(); | 528 | responseData["avatar_uuid"] = userID.ToString(); |
549 | 529 | ||
550 | response.Value = responseData; | 530 | response.Value = responseData; |
551 | 531 | ||
552 | m_log.InfoFormat("[RADMIN]: CreateUser: User {0} {1} created, UUID {2}", firstname, lastname, userID); | 532 | m_log.InfoFormat("[RADMIN]: CreateUser: User {0} {1} created, UUID {2}", firstname, lastname, userID); |
553 | } | 533 | } |
554 | catch (Exception e) | 534 | catch (Exception e) |
555 | { | 535 | { |
556 | m_log.ErrorFormat("[RADMIN] CreateUser: failed: {0}", e.Message); | 536 | m_log.ErrorFormat("[RADMIN] CreateUser: failed: {0}", e.Message); |
557 | m_log.DebugFormat("[RADMIN] CreateUser: failed: {0}", e.ToString()); | 537 | m_log.DebugFormat("[RADMIN] CreateUser: failed: {0}", e.ToString()); |
558 | 538 | ||
559 | responseData["success"] = "false"; | 539 | responseData["success"] = "false"; |
560 | responseData["avatar_uuid"] = LLUUID.Zero.ToString(); | 540 | responseData["avatar_uuid"] = LLUUID.Zero.ToString(); |
561 | responseData["error"] = e.Message; | 541 | responseData["error"] = e.Message; |
562 | 542 | ||
563 | response.Value = responseData; | 543 | response.Value = responseData; |
564 | } | 544 | } |
@@ -573,33 +553,33 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
573 | Hashtable requestData = (Hashtable) request.Params[0]; | 553 | Hashtable requestData = (Hashtable) request.Params[0]; |
574 | Hashtable responseData = new Hashtable(); | 554 | Hashtable responseData = new Hashtable(); |
575 | 555 | ||
576 | try | 556 | try |
577 | { | 557 | { |
578 | // check completeness | 558 | // check completeness |
579 | foreach (string p in new[] {"password", "filename"}) | 559 | foreach (string p in new string[] { "password", "filename" }) |
580 | { | 560 | { |
581 | if (!requestData.Contains(p)) | 561 | if (!requestData.Contains(p)) |
582 | throw new Exception(String.Format("missing parameter {0}", p)); | 562 | throw new Exception(String.Format("missing parameter {0}", p)); |
583 | if (String.IsNullOrEmpty((string) requestData[p])) | 563 | if (String.IsNullOrEmpty((string)requestData[p])) |
584 | throw new Exception(String.Format("parameter {0} is empty")); | 564 | throw new Exception(String.Format("parameter {0} is empty")); |
585 | } | 565 | } |
586 | 566 | ||
587 | // check password | 567 | // check password |
588 | if (!String.IsNullOrEmpty(requiredPassword) && | 568 | if (!String.IsNullOrEmpty(requiredPassword) && |
589 | (string) requestData["password"] != requiredPassword) throw new Exception("wrong password"); | 569 | (string)requestData["password"] != requiredPassword) throw new Exception("wrong password"); |
590 | 570 | ||
591 | string filename = (string) requestData["filename"]; | 571 | string filename = (string)requestData["filename"]; |
592 | if (requestData.Contains("region_uuid")) | 572 | if (requestData.Contains("region_uuid")) |
593 | { | 573 | { |
594 | LLUUID region_uuid = (string) requestData["region_uuid"]; | 574 | LLUUID region_uuid = (string)requestData["region_uuid"]; |
595 | if (!m_app.SceneManager.TrySetCurrentScene(region_uuid)) | 575 | if (!m_app.SceneManager.TrySetCurrentScene(region_uuid)) |
596 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid)); | 576 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); |
597 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); | 577 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); |
598 | } | 578 | } |
599 | else if (requestData.Contains("region_name")) | 579 | else if (requestData.Contains("region_name")) |
600 | { | 580 | { |
601 | string region_name = (string) requestData["region_name"]; | 581 | string region_name = (string)requestData["region_name"]; |
602 | if (!m_app.SceneManager.TrySetCurrentScene(region_name)) | 582 | if (!m_app.SceneManager.TrySetCurrentScene(region_name)) |
603 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); | 583 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); |
604 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); | 584 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); |
605 | } | 585 | } |
@@ -608,23 +588,27 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
608 | responseData["switched"] = "true"; | 588 | responseData["switched"] = "true"; |
609 | 589 | ||
610 | m_app.SceneManager.LoadCurrentSceneFromXml(filename, true, new LLVector3(0, 0, 0)); | 590 | m_app.SceneManager.LoadCurrentSceneFromXml(filename, true, new LLVector3(0, 0, 0)); |
611 | responseData["loaded"] = "true"; | 591 | responseData["loaded"] = "true"; |
612 | 592 | ||
613 | response.Value = responseData; | 593 | response.Value = responseData; |
614 | } | 594 | } |
615 | catch (Exception e) | 595 | catch (Exception e) |
616 | { | 596 | { |
617 | m_log.InfoFormat("[RADMIN] LoadXml: {0}", e.Message); | 597 | m_log.InfoFormat("[RADMIN] LoadXml: {0}", e.Message); |
618 | m_log.DebugFormat("[RADMIN] LoadXml: {0}", e.ToString()); | 598 | m_log.DebugFormat("[RADMIN] LoadXml: {0}", e.ToString()); |
619 | 599 | ||
620 | responseData["loaded"] = "false"; | 600 | responseData["loaded"] = "false"; |
621 | responseData["switched"] = "false"; | 601 | responseData["switched"] = "false"; |
622 | responseData["error"] = e.Message; | 602 | responseData["error"] = e.Message; |
623 | 603 | ||
624 | response.Value = responseData; | 604 | response.Value = responseData; |
625 | } | 605 | } |
626 | 606 | ||
627 | return response; | 607 | return response; |
628 | } | 608 | } |
609 | |||
610 | public void Close() | ||
611 | { | ||
612 | } | ||
629 | } | 613 | } |
630 | } \ No newline at end of file | 614 | } \ No newline at end of file |