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.
0.6.5-rc1
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;
}

View File

@ -693,6 +693,11 @@ InterregionComms = "RESTComms"
ScriptDelayFactor = 1.0
ScriptDistanceLimitFactor = 1.0
; Maximum length of notecard line read
; Increasing this to large values potentially opens
; up the system to malicious scripters
; NotecardLineReadCharsMax = 255
;
; These settings are specific to DotNetEngine script engine
; Other script engines based on OpenSim.Region.ScriptEngine.Common.dll will have almost identical settings, but in another section of this config file.
@ -981,6 +986,11 @@ InterregionComms = "RESTComms"
; The factor the 10 m distances llimits are multiplied by
ScriptDistanceLimitFactor = 1.0
; Maximum length of notecard line read
; Increasing this to large values potentially opens
; up the system to malicious scripters
; NotecardLineReadCharsMax = 255
; OS Functions enable/disable
; For each function, you can add one line, as shown
; The default for all functions allows them if below threat level