diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | 61 |
1 files changed, 40 insertions, 21 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index f1b3ade..6450ec7 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -234,6 +234,29 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
234 | m_app.Shutdown(); | 234 | m_app.Shutdown(); |
235 | } | 235 | } |
236 | 236 | ||
237 | |||
238 | private void checkStringParameters(XmlRpcRequest request, string[] param) | ||
239 | { | ||
240 | Hashtable requestData = (Hashtable) request.Params[0]; | ||
241 | foreach (string p in param) | ||
242 | { | ||
243 | if (!requestData.Contains(p)) | ||
244 | throw new Exception(String.Format("missing string parameter {0}", p)); | ||
245 | if (String.IsNullOrEmpty((string)requestData[p])) | ||
246 | throw new Exception(String.Format("parameter {0} is empty", p)); | ||
247 | } | ||
248 | } | ||
249 | |||
250 | private void checkIntegerParams(XmlRpcRequest request, string[] param) | ||
251 | { | ||
252 | Hashtable requestData = (Hashtable) request.Params[0]; | ||
253 | foreach (string p in param) | ||
254 | { | ||
255 | if (!requestData.Contains(p)) | ||
256 | throw new Exception(String.Format("missing integer parameter {0}", p)); | ||
257 | } | ||
258 | } | ||
259 | |||
237 | /// <summary> | 260 | /// <summary> |
238 | /// Create a new region. | 261 | /// Create a new region. |
239 | /// <summary> | 262 | /// <summary> |
@@ -250,21 +273,24 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
250 | /// <item><term>region_id</term> | 273 | /// <item><term>region_id</term> |
251 | /// <description>(optional) desired region UUID</description></item> | 274 | /// <description>(optional) desired region UUID</description></item> |
252 | /// <item><term>region_x</term> | 275 | /// <item><term>region_x</term> |
253 | /// <description>desired region X coordinate</description></item> | 276 | /// <description>desired region X coordinate (integer)</description></item> |
254 | /// <item><term>region_y</term> | 277 | /// <item><term>region_y</term> |
255 | /// <description>desired region Y coordinate</description></item> | 278 | /// <description>desired region Y coordinate (integer)</description></item> |
256 | /// <item><term>region_master_first</term> | 279 | /// <item><term>region_master_first</term> |
257 | /// <description>firstname of region master</description></item> | 280 | /// <description>firstname of region master</description></item> |
258 | /// <item><term>region_master_last</term> | 281 | /// <item><term>region_master_last</term> |
259 | /// <description>lastname of region master</description></item> | 282 | /// <description>lastname of region master</description></item> |
260 | /// <item><term>listen_ip</term> | 283 | /// <item><term>listen_ip</term> |
261 | /// <description>internal IP address</description></item> | 284 | /// <description>internal IP address (dotted quad)</description></item> |
262 | /// <item><term>listen_port</term> | 285 | /// <item><term>listen_port</term> |
263 | /// <description>internal port</description></item> | 286 | /// <description>internal port (integer)</description></item> |
264 | /// <item><term>external_address</term> | 287 | /// <item><term>external_address</term> |
265 | /// <description>external IP address</description></item> | 288 | /// <description>external IP address</description></item> |
266 | /// <item><term>datastore</term> | 289 | /// <item><term>datastore</term> |
267 | /// <description>datastore parameter (?)</description></item> | 290 | /// <description>datastore parameter (?)</description></item> |
291 | /// <item><term>persist</term> | ||
292 | /// <description>if true, persist the region info | ||
293 | /// ('true' or 'false')</description></item> | ||
268 | /// </list> | 294 | /// </list> |
269 | /// | 295 | /// |
270 | /// XmlRpcCreateRegionMethod returns | 296 | /// XmlRpcCreateRegionMethod returns |
@@ -288,16 +314,12 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
288 | Hashtable responseData = new Hashtable(); | 314 | Hashtable responseData = new Hashtable(); |
289 | 315 | ||
290 | try { | 316 | try { |
291 | // check completeness | 317 | checkStringParameters(request, new string[] { "password", |
292 | foreach (string p in new string[] { "password", | 318 | "region_name", |
293 | "region_name", "region_x", "region_y", | 319 | "region_master_first", "region_master_last", |
294 | "region_master_first", "region_master_last", | 320 | "region_master_password", |
295 | "region_master_password", | 321 | "listen_ip", "external_address"}); |
296 | "listen_ip", "listen_port", "external_address"}) | 322 | checkIntegerParams(request, new string[] { "region_x", "region_y", "listen_port"}); |
297 | { | ||
298 | if (!requestData.Contains(p)) | ||
299 | throw new Exception(String.Format("missing parameter {0}", p)); | ||
300 | } | ||
301 | 323 | ||
302 | // check password | 324 | // check password |
303 | if (!String.IsNullOrEmpty(requiredPassword) && | 325 | if (!String.IsNullOrEmpty(requiredPassword) && |
@@ -350,6 +372,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
350 | new IPEndPoint(IPAddress.Parse((string) requestData["listen_ip"]), 0); | 372 | new IPEndPoint(IPAddress.Parse((string) requestData["listen_ip"]), 0); |
351 | 373 | ||
352 | region.InternalEndPoint.Port = (Int32) requestData["listen_port"]; | 374 | region.InternalEndPoint.Port = (Int32) requestData["listen_port"]; |
375 | if (0 == region.InternalEndPoint.Port) throw new Exception("listen_port is 0"); | ||
353 | if (m_app.SceneManager.TryGetScene(region.InternalEndPoint, out scene)) | 376 | if (m_app.SceneManager.TryGetScene(region.InternalEndPoint, out scene)) |
354 | throw new Exception(String.Format("region internal IP {0} and port {1} already in use by region {2}, UUID {3}, <{4},{5}>", | 377 | throw new Exception(String.Format("region internal IP {0} and port {1} already in use by region {2}, UUID {3}, <{4},{5}>", |
355 | region.InternalEndPoint.Address, | 378 | region.InternalEndPoint.Address, |
@@ -445,13 +468,9 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
445 | try | 468 | try |
446 | { | 469 | { |
447 | // check completeness | 470 | // check completeness |
448 | foreach (string p in new string[] { "password", | 471 | checkStringParameters(request, new string[] { "password", "user_firstname", |
449 | "user_firstname", "user_lastname", "user_password", | 472 | "user_lastname", "user_password" }); |
450 | "start_region_x", "start_region_y" }) | 473 | checkIntegerParams(request, new string[] { "start_region_x", "start_region_y" }); |
451 | { | ||
452 | if (!requestData.Contains(p)) | ||
453 | throw new Exception(String.Format("missing parameter {0}", p)); | ||
454 | } | ||
455 | 474 | ||
456 | // check password | 475 | // check password |
457 | if (!String.IsNullOrEmpty(requiredPassword) && | 476 | if (!String.IsNullOrEmpty(requiredPassword) && |