diff options
author | Justin Clark-Casey (justincc) | 2012-05-09 20:52:54 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-05-09 21:11:14 +0100 |
commit | e813f41478eefb50748e9bdc2b825fa8bc25c971 (patch) | |
tree | 81731ec32a7ca5c3f9693071c4b1dd92047767a3 /OpenSim | |
parent | Mantis 6015 new LSL function llGetAgentList. (diff) | |
download | opensim-SC-e813f41478eefb50748e9bdc2b825fa8bc25c971.zip opensim-SC-e813f41478eefb50748e9bdc2b825fa8bc25c971.tar.gz opensim-SC-e813f41478eefb50748e9bdc2b825fa8bc25c971.tar.bz2 opensim-SC-e813f41478eefb50748e9bdc2b825fa8bc25c971.tar.xz |
Escape and unescape xml element names if necessary in ServerUtils.BuildXmlData() and ParseElement()
If AvatarService appearance data is retrieved over the network, then ServerUtils was attempting to transfer names such as "Wearable 0:0" directly to xml element names, resulting in an exception.
Space is not valid in xml element names. Neither is : in this case since the intention is not to namespace. Using names directly as keys is not a good idea.
To get around this problem this patch escapes and unescapes the element names as appropriate.
This has no impact on existing xml (since it had to be valid in the first place) but allows AvatarService data to be used over the network.
Setting appearance (from simulator to AvatarService) did not suffer this problem since the values are passed in the query string which is already properly escaped.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Server/Base/ServerUtils.cs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index 0cc2a4b..42c82cf 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs | |||
@@ -268,7 +268,7 @@ namespace OpenSim.Server.Base | |||
268 | continue; | 268 | continue; |
269 | 269 | ||
270 | XmlElement elem = parent.OwnerDocument.CreateElement("", | 270 | XmlElement elem = parent.OwnerDocument.CreateElement("", |
271 | kvp.Key, ""); | 271 | XmlConvert.EncodeLocalName(kvp.Key), ""); |
272 | 272 | ||
273 | if (kvp.Value is Dictionary<string, object>) | 273 | if (kvp.Value is Dictionary<string, object>) |
274 | { | 274 | { |
@@ -323,11 +323,11 @@ namespace OpenSim.Server.Base | |||
323 | XmlNode type = part.Attributes.GetNamedItem("type"); | 323 | XmlNode type = part.Attributes.GetNamedItem("type"); |
324 | if (type == null || type.Value != "List") | 324 | if (type == null || type.Value != "List") |
325 | { | 325 | { |
326 | ret[part.Name] = part.InnerText; | 326 | ret[XmlConvert.DecodeName(part.Name)] = part.InnerText; |
327 | } | 327 | } |
328 | else | 328 | else |
329 | { | 329 | { |
330 | ret[part.Name] = ParseElement(part); | 330 | ret[XmlConvert.DecodeName(part.Name)] = ParseElement(part); |
331 | } | 331 | } |
332 | } | 332 | } |
333 | 333 | ||