diff options
Diffstat (limited to 'OpenSim')
4 files changed, 47 insertions, 4 deletions
diff --git a/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs b/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs index 64de18b..1254086 100644 --- a/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs +++ b/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs | |||
@@ -190,6 +190,9 @@ namespace OpenSim.Framework.Serialization.External | |||
190 | if (xmlData == string.Empty || homeURL == string.Empty || userService == null) | 190 | if (xmlData == string.Empty || homeURL == string.Empty || userService == null) |
191 | return xmlData; | 191 | return xmlData; |
192 | 192 | ||
193 | // Deal with bug | ||
194 | xmlData = ExternalRepresentationUtils.SanitizeXml(xmlData); | ||
195 | |||
193 | using (StringWriter sw = new StringWriter()) | 196 | using (StringWriter sw = new StringWriter()) |
194 | using (XmlTextWriter writer = new XmlTextWriter(sw)) | 197 | using (XmlTextWriter writer = new XmlTextWriter(sw)) |
195 | using (XmlTextReader wrappedReader = new XmlTextReader(xmlData, XmlNodeType.Element, null)) | 198 | using (XmlTextReader wrappedReader = new XmlTextReader(xmlData, XmlNodeType.Element, null)) |
@@ -364,5 +367,21 @@ namespace OpenSim.Framework.Serialization.External | |||
364 | { | 367 | { |
365 | return homeURL + "/" + uuid + ";" + name; | 368 | return homeURL + "/" + uuid + ";" + name; |
366 | } | 369 | } |
370 | |||
371 | /// <summary> | ||
372 | /// Sanitation for bug introduced in Oct. 20 (1eb3e6cc43e2a7b4053bc1185c7c88e22356c5e8) | ||
373 | /// </summary> | ||
374 | /// <param name="xmlData"></param> | ||
375 | /// <returns></returns> | ||
376 | public static string SanitizeXml(string xmlData) | ||
377 | { | ||
378 | string fixedData = xmlData; | ||
379 | if (fixedData != null) | ||
380 | // Loop, because it may contain multiple | ||
381 | while (fixedData.Contains("xmlns:xmlns:")) | ||
382 | fixedData = fixedData.Replace("xmlns:xmlns:", "xmlns:"); | ||
383 | return fixedData; | ||
384 | } | ||
385 | |||
367 | } | 386 | } |
368 | } | 387 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index c14ce1e..dde54d5 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -37,6 +37,7 @@ using OpenMetaverse; | |||
37 | using OpenMetaverse.Packets; | 37 | using OpenMetaverse.Packets; |
38 | using log4net; | 38 | using log4net; |
39 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
40 | using OpenSim.Framework.Serialization.External; | ||
40 | using OpenSim.Region.Framework; | 41 | using OpenSim.Region.Framework; |
41 | using OpenSim.Framework.Client; | 42 | using OpenSim.Framework.Client; |
42 | using OpenSim.Region.Framework.Interfaces; | 43 | using OpenSim.Region.Framework.Interfaces; |
@@ -2225,7 +2226,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2225 | bbox = Vector3.Zero; | 2226 | bbox = Vector3.Zero; |
2226 | offsetHeight = 0; | 2227 | offsetHeight = 0; |
2227 | 2228 | ||
2228 | string xmlData = Utils.BytesToString(assetData); | 2229 | string xmlData = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(assetData)); |
2229 | 2230 | ||
2230 | try | 2231 | try |
2231 | { | 2232 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index cb13ca4..463ef22 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | |||
@@ -52,7 +52,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
53 | 53 | ||
54 | private static IUserManagement m_UserManagement; | 54 | private static IUserManagement m_UserManagement; |
55 | 55 | ||
56 | /// <summary> | 56 | /// <summary> |
57 | /// Deserialize a scene object from the original xml format | 57 | /// Deserialize a scene object from the original xml format |
58 | /// </summary> | 58 | /// </summary> |
@@ -60,7 +60,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
60 | /// <returns>The scene object deserialized. Null on failure.</returns> | 60 | /// <returns>The scene object deserialized. Null on failure.</returns> |
61 | public static SceneObjectGroup FromOriginalXmlFormat(string xmlData) | 61 | public static SceneObjectGroup FromOriginalXmlFormat(string xmlData) |
62 | { | 62 | { |
63 | using (XmlTextReader wrappedReader = new XmlTextReader(xmlData, XmlNodeType.Element, null)) | 63 | String fixedData = ExternalRepresentationUtils.SanitizeXml(xmlData); |
64 | using (XmlTextReader wrappedReader = new XmlTextReader(fixedData, XmlNodeType.Element, null)) | ||
64 | using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment })) | 65 | using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment })) |
65 | return FromOriginalXmlFormat(reader); | 66 | return FromOriginalXmlFormat(reader); |
66 | } | 67 | } |
@@ -322,7 +323,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
322 | List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>(); | 323 | List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>(); |
323 | CoalescedSceneObjects coa = null; | 324 | CoalescedSceneObjects coa = null; |
324 | 325 | ||
325 | string xmlData = Utils.BytesToString(data); | 326 | string xmlData = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(data)); |
326 | 327 | ||
327 | if (CoalescedSceneObjectsSerializer.TryFromXml(xmlData, out coa)) | 328 | if (CoalescedSceneObjectsSerializer.TryFromXml(xmlData, out coa)) |
328 | { | 329 | { |
diff --git a/OpenSim/Services/HypergridService/HGAssetService.cs b/OpenSim/Services/HypergridService/HGAssetService.cs index a829932..b83fb1e 100644 --- a/OpenSim/Services/HypergridService/HGAssetService.cs +++ b/OpenSim/Services/HypergridService/HGAssetService.cs | |||
@@ -129,6 +129,14 @@ namespace OpenSim.Services.HypergridService | |||
129 | if (!m_AssetPerms.AllowedExport(asset.Type)) | 129 | if (!m_AssetPerms.AllowedExport(asset.Type)) |
130 | return null; | 130 | return null; |
131 | 131 | ||
132 | // Deal with bug introduced in Oct. 20 (1eb3e6cc43e2a7b4053bc1185c7c88e22356c5e8) | ||
133 | // Fix bad assets before sending them elsewhere | ||
134 | if (asset.Type == (int)AssetType.Object && asset.Data != null) | ||
135 | { | ||
136 | string xml = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(asset.Data)); | ||
137 | asset.Data = Utils.StringToBytes(xml); | ||
138 | } | ||
139 | |||
132 | return asset.Data; | 140 | return asset.Data; |
133 | } | 141 | } |
134 | 142 | ||
@@ -139,6 +147,14 @@ namespace OpenSim.Services.HypergridService | |||
139 | if (!m_AssetPerms.AllowedImport(asset.Type)) | 147 | if (!m_AssetPerms.AllowedImport(asset.Type)) |
140 | return string.Empty; | 148 | return string.Empty; |
141 | 149 | ||
150 | // Deal with bug introduced in Oct. 20 (1eb3e6cc43e2a7b4053bc1185c7c88e22356c5e8) | ||
151 | // Fix bad assets before storing on this server | ||
152 | if (asset.Type == (int)AssetType.Object && asset.Data != null) | ||
153 | { | ||
154 | string xml = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(asset.Data)); | ||
155 | asset.Data = Utils.StringToBytes(xml); | ||
156 | } | ||
157 | |||
142 | return base.Store(asset); | 158 | return base.Store(asset); |
143 | } | 159 | } |
144 | 160 | ||
@@ -160,9 +176,15 @@ namespace OpenSim.Services.HypergridService | |||
160 | meta.CreatorID = meta.CreatorID + ";" + m_HomeURL + "/" + creator.FirstName + " " + creator.LastName; | 176 | meta.CreatorID = meta.CreatorID + ";" + m_HomeURL + "/" + creator.FirstName + " " + creator.LastName; |
161 | } | 177 | } |
162 | 178 | ||
179 | // Only for Object | ||
163 | protected byte[] AdjustIdentifiers(byte[] data) | 180 | protected byte[] AdjustIdentifiers(byte[] data) |
164 | { | 181 | { |
165 | string xml = Utils.BytesToString(data); | 182 | string xml = Utils.BytesToString(data); |
183 | |||
184 | // Deal with bug introduced in Oct. 20 (1eb3e6cc43e2a7b4053bc1185c7c88e22356c5e8) | ||
185 | // Fix bad assets before sending them elsewhere | ||
186 | xml = ExternalRepresentationUtils.SanitizeXml(xml); | ||
187 | |||
166 | return Utils.StringToBytes(ExternalRepresentationUtils.RewriteSOP(xml, "HGAssetService", m_HomeURL, m_Cache, UUID.Zero)); | 188 | return Utils.StringToBytes(ExternalRepresentationUtils.RewriteSOP(xml, "HGAssetService", m_HomeURL, m_Cache, UUID.Zero)); |
167 | } | 189 | } |
168 | 190 | ||