diff options
author | Diva Canto | 2015-08-01 18:58:05 -0700 |
---|---|---|
committer | Diva Canto | 2015-08-01 18:58:05 -0700 |
commit | e5a1243abc04c3f6f62e94425fea25b2ad84b577 (patch) | |
tree | 6b408e3b9cf8bb35a7de9042be8270df3900809f /OpenSim/Services | |
parent | Mantis #7664: Added IHypergridLinker interface to establish a contract about ... (diff) | |
download | opensim-SC-e5a1243abc04c3f6f62e94425fea25b2ad84b577.zip opensim-SC-e5a1243abc04c3f6f62e94425fea25b2ad84b577.tar.gz opensim-SC-e5a1243abc04c3f6f62e94425fea25b2ad84b577.tar.bz2 opensim-SC-e5a1243abc04c3f6f62e94425fea25b2ad84b577.tar.xz |
Mantis #7657 and #7514. This should alleviate the problem of bad object assets being passed around via HG and archives. No guarantees that all the leaks have been found, but at least it detects and fixes these bad assets upon:
(1) storing and getting assets over HG -- assuming the core HG asset service is being used (not the case with OSGrid!)
(2) importing assets via OAR and IAR
Instantiation of bad assets now should also work, instead of producing an exception, but the bad assets themselves aren't being fixed in the DB. That should be done with a cleaning tool -- see Perl script in Mantis #7657.
Virus!
Diffstat (limited to 'OpenSim/Services')
-rw-r--r-- | OpenSim/Services/HypergridService/HGAssetService.cs | 22 |
1 files changed, 22 insertions, 0 deletions
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 | ||