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.
This commit is contained in:
Dr Scofield
2009-03-17 07:03:53 +00:00
parent 66f0445173
commit b2de81ebac
2 changed files with 20 additions and 5 deletions

View File

@@ -82,6 +82,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
private bool m_waitingForScriptAnswer=false;
private bool m_automaticLinkPermission=false;
private IMessageTransferModule m_TransferModule = null;
private int m_notecardLineReadCharsMax = 255;
//private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
@@ -100,6 +101,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_ScriptEngine.Config.GetFloat("MinTimerInterval", 0.5f);
m_automaticLinkPermission =
m_ScriptEngine.Config.GetBoolean("AutomaticLinkPermission", false);
m_notecardLineReadCharsMax =
m_ScriptEngine.Config.GetInt("NotecardLineReadCharsMax", 255);
if (m_notecardLineReadCharsMax > 65535)
m_notecardLineReadCharsMax = 65535;
m_TransferModule =
m_ScriptEngine.World.RequestModuleInterface<IMessageTransferModule>();
@@ -9133,7 +9138,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
AsyncCommands.
DataserverPlugin.DataserverReply(item.AssetID.ToString(),
NotecardCache.GetLine(item.AssetID, line));
NotecardCache.GetLine(item.AssetID, line, m_notecardLineReadCharsMax));
// ScriptSleep(100);
return tid.ToString();
}
@@ -9147,7 +9152,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
NotecardCache.Cache(id, data);
AsyncCommands.
DataserverPlugin.DataserverReply(id.ToString(),
NotecardCache.GetLine(id, line));
NotecardCache.GetLine(id, line, m_notecardLineReadCharsMax));
});
// ScriptSleep(100);
@@ -9291,7 +9296,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
public static string GetLine(UUID assetID, int line)
public static string GetLine(UUID assetID, int line, int maxLength)
{
if (line < 0)
return "";
@@ -9309,8 +9314,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return "\n\n\n";
data = m_Notecards[assetID].text[line];
if (data.Length > 255)
data = data.Substring(0, 255);
if (data.Length > maxLength)
data = data.Substring(0, maxLength);
return data;
}