diff options
author | Melanie Thielker | 2008-12-05 20:30:00 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-12-05 20:30:00 +0000 |
commit | d24e4a9f2d860db87ca191242861453547f82e65 (patch) | |
tree | 5d80cbb6d9885cb1a8bf98e7a7c64e6fe1b50bad /OpenSim | |
parent | - Use the http-port that is now provided by the grid-server. If it isn't (bec... (diff) | |
download | opensim-SC_OLD-d24e4a9f2d860db87ca191242861453547f82e65.zip opensim-SC_OLD-d24e4a9f2d860db87ca191242861453547f82e65.tar.gz opensim-SC_OLD-d24e4a9f2d860db87ca191242861453547f82e65.tar.bz2 opensim-SC_OLD-d24e4a9f2d860db87ca191242861453547f82e65.tar.xz |
Committing the missing bits to enable script crossing. Disabled by default.
For a script to successfully cross, both source and destination region must
enable the feature. WARNING: Trusting binaries from other sims allows
ARBITRARY REMOTE CODE EXECUTION for ANYONE! Please do not use except
in ultimate trust scenarios!
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 81 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPartInventory.cs | 1 |
2 files changed, 81 insertions, 1 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 7e13671..79a626e 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -2098,9 +2098,16 @@ namespace OpenSim.Region.Environment.Scenes | |||
2098 | 2098 | ||
2099 | if (newRegionHandle != 0) | 2099 | if (newRegionHandle != 0) |
2100 | { | 2100 | { |
2101 | string objectState = grp.GetStateSnapshot(); | ||
2102 | |||
2101 | successYN | 2103 | successYN |
2102 | = m_sceneGridService.PrimCrossToNeighboringRegion( | 2104 | = m_sceneGridService.PrimCrossToNeighboringRegion( |
2103 | newRegionHandle, grp.UUID, m_serialiser.SaveGroupToXml2(grp), primcrossingXMLmethod); | 2105 | newRegionHandle, grp.UUID, m_serialiser.SaveGroupToXml2(grp), primcrossingXMLmethod); |
2106 | if (successYN && (objectState != "") && m_allowScriptCrossings) | ||
2107 | { | ||
2108 | successYN = m_sceneGridService.PrimCrossToNeighboringRegion( | ||
2109 | newRegionHandle, grp.UUID, objectState, 100); | ||
2110 | } | ||
2104 | 2111 | ||
2105 | if (successYN) | 2112 | if (successYN) |
2106 | { | 2113 | { |
@@ -2147,10 +2154,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
2147 | /// <returns></returns> | 2154 | /// <returns></returns> |
2148 | public bool IncomingInterRegionPrimGroup(UUID primID, string objXMLData, int XMLMethod) | 2155 | public bool IncomingInterRegionPrimGroup(UUID primID, string objXMLData, int XMLMethod) |
2149 | { | 2156 | { |
2150 | m_log.DebugFormat("[INTERREGION]: A new prim {0} arrived from a neighbor", primID); | ||
2151 | 2157 | ||
2152 | if (XMLMethod == 0) | 2158 | if (XMLMethod == 0) |
2153 | { | 2159 | { |
2160 | m_log.DebugFormat("[INTERREGION]: A new prim {0} arrived from a neighbor", primID); | ||
2154 | SceneObjectGroup sceneObject = m_serialiser.DeserializeGroupFromXml2(objXMLData); | 2161 | SceneObjectGroup sceneObject = m_serialiser.DeserializeGroupFromXml2(objXMLData); |
2155 | 2162 | ||
2156 | // If the user is banned, we won't let any of their objects | 2163 | // If the user is banned, we won't let any of their objects |
@@ -2242,6 +2249,78 @@ namespace OpenSim.Region.Environment.Scenes | |||
2242 | } | 2249 | } |
2243 | } | 2250 | } |
2244 | } | 2251 | } |
2252 | else if ((XMLMethod == 100) && m_allowScriptCrossings) | ||
2253 | { | ||
2254 | m_log.Warn("[INTERREGION]: Prim state data arrived from a neighbor"); | ||
2255 | XmlDocument doc = new XmlDocument(); | ||
2256 | doc.LoadXml(objXMLData); | ||
2257 | |||
2258 | XmlNodeList rootL = doc.GetElementsByTagName("ScriptData"); | ||
2259 | if (rootL.Count == 1) | ||
2260 | { | ||
2261 | XmlNode rootNode = rootL[0]; | ||
2262 | if (rootNode != null) | ||
2263 | { | ||
2264 | XmlNodeList partL = rootNode.ChildNodes; | ||
2265 | |||
2266 | foreach (XmlNode part in partL) | ||
2267 | { | ||
2268 | XmlNodeList nodeL = part.ChildNodes; | ||
2269 | |||
2270 | switch (part.Name) | ||
2271 | { | ||
2272 | case "Assemblies": | ||
2273 | foreach (XmlNode asm in nodeL) | ||
2274 | { | ||
2275 | string fn = asm.Attributes.GetNamedItem("Filename").Value; | ||
2276 | |||
2277 | Byte[] filedata = Convert.FromBase64String(asm.InnerText); | ||
2278 | string path = Path.Combine("ScriptEngines", RegionInfo.RegionID.ToString()); | ||
2279 | path = Path.Combine(path, fn); | ||
2280 | |||
2281 | if (!File.Exists(path)) | ||
2282 | { | ||
2283 | FileStream fs = File.Create(path); | ||
2284 | fs.Write(filedata, 0, filedata.Length); | ||
2285 | fs.Close(); | ||
2286 | } | ||
2287 | } | ||
2288 | break; | ||
2289 | case "ScriptStates": | ||
2290 | foreach (XmlNode st in nodeL) | ||
2291 | { | ||
2292 | string id = st.Attributes.GetNamedItem("UUID").Value; | ||
2293 | UUID uuid = new UUID(id); | ||
2294 | XmlNode state = st.ChildNodes[0]; | ||
2295 | |||
2296 | XmlDocument sdoc = new XmlDocument(); | ||
2297 | XmlNode sxmlnode = sdoc.CreateNode( | ||
2298 | XmlNodeType.XmlDeclaration, | ||
2299 | "", ""); | ||
2300 | sdoc.AppendChild(sxmlnode); | ||
2301 | |||
2302 | XmlNode newnode = sdoc.ImportNode(state, true); | ||
2303 | sdoc.AppendChild(newnode); | ||
2304 | |||
2305 | string spath = Path.Combine("ScriptEngines", RegionInfo.RegionID.ToString()); | ||
2306 | spath = Path.Combine(spath, uuid.ToString()); | ||
2307 | FileStream sfs = File.Create(spath + ".state"); | ||
2308 | System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); | ||
2309 | Byte[] buf = enc.GetBytes(sdoc.InnerXml); | ||
2310 | sfs.Write(buf, 0, buf.Length); | ||
2311 | sfs.Close(); | ||
2312 | } | ||
2313 | break; | ||
2314 | } | ||
2315 | } | ||
2316 | } | ||
2317 | } | ||
2318 | |||
2319 | SceneObjectPart RootPrim = GetSceneObjectPart(primID); | ||
2320 | RootPrim.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, 1); | ||
2321 | |||
2322 | return true; | ||
2323 | } | ||
2245 | 2324 | ||
2246 | return true; | 2325 | return true; |
2247 | } | 2326 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPartInventory.cs index 545d603..8137a53 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPartInventory.cs | |||
@@ -250,6 +250,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
250 | m_part.LocalId, item.ItemID, String.Empty, startParam, postOnRez, engine, stateSource); | 250 | m_part.LocalId, item.ItemID, String.Empty, startParam, postOnRez, engine, stateSource); |
251 | m_part.ParentGroup.AddActiveScriptCount(1); | 251 | m_part.ParentGroup.AddActiveScriptCount(1); |
252 | m_part.ScheduleFullUpdate(); | 252 | m_part.ScheduleFullUpdate(); |
253 | return; | ||
253 | } | 254 | } |
254 | AssetCache cache = m_part.ParentGroup.Scene.AssetCache; | 255 | AssetCache cache = m_part.ParentGroup.Scene.AssetCache; |
255 | 256 | ||