* Fixed: Accessing xmlrpc with invalid xml data would crash the sim.

* Ignored some bins and gens
afrisby
lbsa71 2007-09-10 04:30:11 +00:00
parent 86e3fc3da2
commit 7adc2212c7
1 changed files with 31 additions and 17 deletions

View File

@ -35,6 +35,7 @@ using System.Text.RegularExpressions;
using System.Threading; using System.Threading;
using Nwc.XmlRpc; using Nwc.XmlRpc;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using System.Xml;
namespace OpenSim.Framework.Servers namespace OpenSim.Framework.Servers
{ {
@ -153,8 +154,20 @@ namespace OpenSim.Framework.Servers
reader.Close(); reader.Close();
requestStream.Close(); requestStream.Close();
XmlRpcRequest xmlRprcRequest = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody); string responseString = String.Empty;
XmlRpcRequest xmlRprcRequest = null;
try
{
xmlRprcRequest = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody);
}
catch ( XmlException e )
{
responseString = String.Format( "XmlException:\n{0}",e.Message );
}
if (xmlRprcRequest != null)
{
string methodName = xmlRprcRequest.MethodName; string methodName = xmlRprcRequest.MethodName;
XmlRpcResponse xmlRpcResponse; XmlRpcResponse xmlRpcResponse;
@ -174,9 +187,10 @@ namespace OpenSim.Framework.Servers
xmlRpcResponse.Value = unknownMethodError; xmlRpcResponse.Value = unknownMethodError;
} }
response.AddHeader("Content-type", "text/xml"); responseString = XmlRpcResponseSerializer.Singleton.Serialize(xmlRpcResponse);
}
string responseString = XmlRpcResponseSerializer.Singleton.Serialize(xmlRpcResponse); response.AddHeader("Content-type", "text/xml");
byte[] buffer = Encoding.UTF8.GetBytes(responseString); byte[] buffer = Encoding.UTF8.GetBytes(responseString);