diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 40 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 37 |
2 files changed, 63 insertions, 14 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index fb191e6..d49bbb2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -9829,19 +9829,39 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9829 | public LSL_String llXorBase64StringsCorrect(string str1, string str2) | 9829 | public LSL_String llXorBase64StringsCorrect(string str1, string str2) |
9830 | { | 9830 | { |
9831 | m_host.AddScriptLPS(1); | 9831 | m_host.AddScriptLPS(1); |
9832 | string ret = String.Empty; | 9832 | |
9833 | string src1 = llBase64ToString(str1); | 9833 | if (str1 == String.Empty) |
9834 | string src2 = llBase64ToString(str2); | 9834 | return String.Empty; |
9835 | int c = 0; | 9835 | if (str2 == String.Empty) |
9836 | for (int i = 0; i < src1.Length; i++) | 9836 | return str1; |
9837 | |||
9838 | byte[] data1 = Convert.FromBase64String(str1); | ||
9839 | byte[] data2 = Convert.FromBase64String(str2); | ||
9840 | |||
9841 | byte[] d2 = new Byte[data1.Length]; | ||
9842 | int pos = 0; | ||
9843 | |||
9844 | if (data1.Length <= data2.Length) | ||
9837 | { | 9845 | { |
9838 | ret += (char) (src1[i] ^ src2[c]); | 9846 | Array.Copy(data2, 0, d2, 0, data1.Length); |
9847 | } | ||
9848 | else | ||
9849 | { | ||
9850 | while (pos < data1.Length) | ||
9851 | { | ||
9852 | int len = data1.Length - pos; | ||
9853 | if (len > data2.Length) | ||
9854 | len = data2.Length; | ||
9839 | 9855 | ||
9840 | c++; | 9856 | Array.Copy(data2, 0, d2, pos, len); |
9841 | if (c >= src2.Length) | 9857 | pos += len; |
9842 | c = 0; | 9858 | } |
9843 | } | 9859 | } |
9844 | return llStringToBase64(ret); | 9860 | |
9861 | for (pos = 0 ; pos < data1.Length ; pos++ ) | ||
9862 | data1[pos] ^= d2[pos]; | ||
9863 | |||
9864 | return Convert.ToBase64String(data1); | ||
9845 | } | 9865 | } |
9846 | 9866 | ||
9847 | public LSL_String llHTTPRequest(string url, LSL_List parameters, string body) | 9867 | public LSL_String llHTTPRequest(string url, LSL_List parameters, string body) |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 30e127d..bbaf923 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -556,6 +556,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
556 | 556 | ||
557 | if (stateSource == (int)StateSource.ScriptedRez) | 557 | if (stateSource == (int)StateSource.ScriptedRez) |
558 | { | 558 | { |
559 | lock (m_CompileDict) | ||
560 | { | ||
561 | m_CompileDict[itemID] = 0; | ||
562 | } | ||
563 | |||
559 | DoOnRezScript(parms); | 564 | DoOnRezScript(parms); |
560 | } | 565 | } |
561 | else | 566 | else |
@@ -1356,9 +1361,23 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1356 | string xml = instance.GetXMLState(); | 1361 | string xml = instance.GetXMLState(); |
1357 | 1362 | ||
1358 | XmlDocument sdoc = new XmlDocument(); | 1363 | XmlDocument sdoc = new XmlDocument(); |
1359 | sdoc.LoadXml(xml); | 1364 | bool loadedState = true; |
1360 | XmlNodeList rootL = sdoc.GetElementsByTagName("ScriptState"); | 1365 | try |
1361 | XmlNode rootNode = rootL[0]; | 1366 | { |
1367 | sdoc.LoadXml(xml); | ||
1368 | } | ||
1369 | catch (System.Xml.XmlException e) | ||
1370 | { | ||
1371 | loadedState = false; | ||
1372 | } | ||
1373 | |||
1374 | XmlNodeList rootL = null; | ||
1375 | XmlNode rootNode = null; | ||
1376 | if (loadedState) | ||
1377 | { | ||
1378 | rootL = sdoc.GetElementsByTagName("ScriptState"); | ||
1379 | rootNode = rootL[0]; | ||
1380 | } | ||
1362 | 1381 | ||
1363 | // Create <State UUID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"> | 1382 | // Create <State UUID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"> |
1364 | XmlDocument doc = new XmlDocument(); | 1383 | XmlDocument doc = new XmlDocument(); |
@@ -1374,8 +1393,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1374 | stateData.Attributes.Append(engineName); | 1393 | stateData.Attributes.Append(engineName); |
1375 | doc.AppendChild(stateData); | 1394 | doc.AppendChild(stateData); |
1376 | 1395 | ||
1396 | XmlNode xmlstate = null; | ||
1397 | |||
1377 | // Add <ScriptState>...</ScriptState> | 1398 | // Add <ScriptState>...</ScriptState> |
1378 | XmlNode xmlstate = doc.ImportNode(rootNode, true); | 1399 | if (loadedState) |
1400 | { | ||
1401 | xmlstate = doc.ImportNode(rootNode, true); | ||
1402 | } | ||
1403 | else | ||
1404 | { | ||
1405 | xmlstate = doc.CreateElement("", "ScriptState", ""); | ||
1406 | } | ||
1407 | |||
1379 | stateData.AppendChild(xmlstate); | 1408 | stateData.AppendChild(xmlstate); |
1380 | 1409 | ||
1381 | string assemName = instance.GetAssemblyName(); | 1410 | string assemName = instance.GetAssemblyName(); |