making XmlRpcs of RemoteController more robust; this fixes mantis #1467

0.6.0-stable
Dr Scofield 2008-07-01 08:50:22 +00:00
parent 5e63206018
commit 0a657b9416
1 changed files with 23 additions and 17 deletions

View File

@ -98,12 +98,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController
public XmlRpcResponse XmlRpcRestartMethod(XmlRpcRequest request) public XmlRpcResponse XmlRpcRestartMethod(XmlRpcRequest request)
{ {
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable) request.Params[0];
Hashtable responseData = new Hashtable(); Hashtable responseData = new Hashtable();
m_log.Info("[RADMIN]: Request to restart Region.");
try { try {
Hashtable requestData = (Hashtable) request.Params[0];
m_log.Info("[RADMIN]: Request to restart Region.");
checkStringParameters(request, new string[] { "password", "regionID" }); checkStringParameters(request, new string[] { "password", "regionID" });
if (requiredPassword != String.Empty && if (requiredPassword != String.Empty &&
@ -140,10 +140,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController
public XmlRpcResponse XmlRpcAlertMethod(XmlRpcRequest request) public XmlRpcResponse XmlRpcAlertMethod(XmlRpcRequest request)
{ {
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable) request.Params[0];
Hashtable responseData = new Hashtable(); Hashtable responseData = new Hashtable();
try { try {
Hashtable requestData = (Hashtable) request.Params[0];
checkStringParameters(request, new string[] { "password", "message" }); checkStringParameters(request, new string[] { "password", "message" });
if (requiredPassword != String.Empty && if (requiredPassword != String.Empty &&
@ -175,17 +176,18 @@ namespace OpenSim.ApplicationPlugins.RemoteController
public XmlRpcResponse XmlRpcLoadHeightmapMethod(XmlRpcRequest request) public XmlRpcResponse XmlRpcLoadHeightmapMethod(XmlRpcRequest request)
{ {
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();
Hashtable responseData = new Hashtable();
try {
Hashtable requestData = (Hashtable)request.Params[0]; Hashtable requestData = (Hashtable)request.Params[0];
m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}", request.ToString()); m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}", request.ToString());
foreach (string k in requestData.Keys) // foreach (string k in requestData.Keys)
{ // {
m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}: >{1}< {2}", // m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}: >{1}< {2}",
k, (string)requestData[k], ((string)requestData[k]).Length); // k, (string)requestData[k], ((string)requestData[k]).Length);
} // }
Hashtable responseData = new Hashtable();
try {
checkStringParameters(request, new string[] { "password", "filename", "regionid"}); checkStringParameters(request, new string[] { "password", "filename", "regionid"});
if (requiredPassword != String.Empty && if (requiredPassword != String.Empty &&
@ -227,10 +229,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController
{ {
m_log.Info("[RADMIN]: Received Shutdown Administrator Request"); m_log.Info("[RADMIN]: Received Shutdown Administrator Request");
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable) request.Params[0];
Hashtable responseData = new Hashtable(); Hashtable responseData = new Hashtable();
try { try {
Hashtable requestData = (Hashtable) request.Params[0];
if (requiredPassword != String.Empty && if (requiredPassword != String.Empty &&
(!requestData.Contains("password") || (string) requestData["password"] != requiredPassword)) (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword))
throw new Exception("wrong password"); throw new Exception("wrong password");
@ -355,10 +358,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController
{ {
m_log.Info("[RADMIN]: CreateRegion: new request"); m_log.Info("[RADMIN]: CreateRegion: new request");
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable) request.Params[0];
Hashtable responseData = new Hashtable(); Hashtable responseData = new Hashtable();
try { try {
Hashtable requestData = (Hashtable) request.Params[0];
checkStringParameters(request, new string[] { "password", checkStringParameters(request, new string[] { "password",
"region_name", "region_name",
"region_master_first", "region_master_last", "region_master_first", "region_master_last",
@ -507,11 +511,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController
{ {
m_log.Info("[RADMIN]: CreateUser: new request"); m_log.Info("[RADMIN]: CreateUser: new request");
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable) request.Params[0];
Hashtable responseData = new Hashtable(); Hashtable responseData = new Hashtable();
try try
{ {
Hashtable requestData = (Hashtable) request.Params[0];
// check completeness // check completeness
checkStringParameters(request, new string[] { "password", "user_firstname", checkStringParameters(request, new string[] { "password", "user_firstname",
"user_lastname", "user_password" }); "user_lastname", "user_password" });
@ -563,11 +568,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController
{ {
m_log.Info("[RADMIN]: Received Load XML Administrator Request"); m_log.Info("[RADMIN]: Received Load XML Administrator Request");
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable) request.Params[0];
Hashtable responseData = new Hashtable(); Hashtable responseData = new Hashtable();
try try
{ {
Hashtable requestData = (Hashtable) request.Params[0];
// check completeness // check completeness
foreach (string p in new string[] { "password", "filename" }) foreach (string p in new string[] { "password", "filename" })
{ {