diff options
author | Dr Scofield | 2009-03-17 07:03:53 +0000 |
---|---|---|
committer | Dr Scofield | 2009-03-17 07:03:53 +0000 |
commit | b2de81ebac9d07e8377814e47e7e261612e974bb (patch) | |
tree | 1eadefb8e69d7c8adb013a99df3b98221ed9f6d2 /OpenSim/Region/ScriptEngine/Shared/Api/Implementation | |
parent | Mantis#3306: Thanks tlaukkan for a patch that (diff) | |
download | opensim-SC_OLD-b2de81ebac9d07e8377814e47e7e261612e974bb.zip opensim-SC_OLD-b2de81ebac9d07e8377814e47e7e261612e974bb.tar.gz opensim-SC_OLD-b2de81ebac9d07e8377814e47e7e261612e974bb.tar.bz2 opensim-SC_OLD-b2de81ebac9d07e8377814e47e7e261612e974bb.tar.xz |
From: Christopher Yeoh <yeohc@au1.ibm.com>
Attached is a patch which enabled through an OpenSim.ini option the ability
to read long notecard lines. Currently although the data is read from
the notecard it is truncated at 255 characters (same as for the LL servers.
This patch allows the setting of that limit to a different value.
; Maximum length of notecard line read
; Increasing this to large values potentially opens
; up the system to malicious scripters
; NotecardLineReadCharsMax = 255
this allows for save/restore functionality using notecards without
having to worry about very short line length limits.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 1ede395..f809ef2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -82,6 +82,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
82 | private bool m_waitingForScriptAnswer=false; | 82 | private bool m_waitingForScriptAnswer=false; |
83 | private bool m_automaticLinkPermission=false; | 83 | private bool m_automaticLinkPermission=false; |
84 | private IMessageTransferModule m_TransferModule = null; | 84 | private IMessageTransferModule m_TransferModule = null; |
85 | private int m_notecardLineReadCharsMax = 255; | ||
85 | 86 | ||
86 | //private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 87 | //private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
87 | 88 | ||
@@ -100,6 +101,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
100 | m_ScriptEngine.Config.GetFloat("MinTimerInterval", 0.5f); | 101 | m_ScriptEngine.Config.GetFloat("MinTimerInterval", 0.5f); |
101 | m_automaticLinkPermission = | 102 | m_automaticLinkPermission = |
102 | m_ScriptEngine.Config.GetBoolean("AutomaticLinkPermission", false); | 103 | m_ScriptEngine.Config.GetBoolean("AutomaticLinkPermission", false); |
104 | m_notecardLineReadCharsMax = | ||
105 | m_ScriptEngine.Config.GetInt("NotecardLineReadCharsMax", 255); | ||
106 | if (m_notecardLineReadCharsMax > 65535) | ||
107 | m_notecardLineReadCharsMax = 65535; | ||
103 | 108 | ||
104 | m_TransferModule = | 109 | m_TransferModule = |
105 | m_ScriptEngine.World.RequestModuleInterface<IMessageTransferModule>(); | 110 | m_ScriptEngine.World.RequestModuleInterface<IMessageTransferModule>(); |
@@ -9133,7 +9138,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9133 | { | 9138 | { |
9134 | AsyncCommands. | 9139 | AsyncCommands. |
9135 | DataserverPlugin.DataserverReply(item.AssetID.ToString(), | 9140 | DataserverPlugin.DataserverReply(item.AssetID.ToString(), |
9136 | NotecardCache.GetLine(item.AssetID, line)); | 9141 | NotecardCache.GetLine(item.AssetID, line, m_notecardLineReadCharsMax)); |
9137 | // ScriptSleep(100); | 9142 | // ScriptSleep(100); |
9138 | return tid.ToString(); | 9143 | return tid.ToString(); |
9139 | } | 9144 | } |
@@ -9147,7 +9152,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9147 | NotecardCache.Cache(id, data); | 9152 | NotecardCache.Cache(id, data); |
9148 | AsyncCommands. | 9153 | AsyncCommands. |
9149 | DataserverPlugin.DataserverReply(id.ToString(), | 9154 | DataserverPlugin.DataserverReply(id.ToString(), |
9150 | NotecardCache.GetLine(id, line)); | 9155 | NotecardCache.GetLine(id, line, m_notecardLineReadCharsMax)); |
9151 | }); | 9156 | }); |
9152 | 9157 | ||
9153 | // ScriptSleep(100); | 9158 | // ScriptSleep(100); |
@@ -9291,7 +9296,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9291 | } | 9296 | } |
9292 | } | 9297 | } |
9293 | 9298 | ||
9294 | public static string GetLine(UUID assetID, int line) | 9299 | public static string GetLine(UUID assetID, int line, int maxLength) |
9295 | { | 9300 | { |
9296 | if (line < 0) | 9301 | if (line < 0) |
9297 | return ""; | 9302 | return ""; |
@@ -9309,8 +9314,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9309 | return "\n\n\n"; | 9314 | return "\n\n\n"; |
9310 | 9315 | ||
9311 | data = m_Notecards[assetID].text[line]; | 9316 | data = m_Notecards[assetID].text[line]; |
9312 | if (data.Length > 255) | 9317 | if (data.Length > maxLength) |
9313 | data = data.Substring(0, 255); | 9318 | data = data.Substring(0, maxLength); |
9314 | 9319 | ||
9315 | return data; | 9320 | return data; |
9316 | } | 9321 | } |