Fix unsafe code in FSData and made reqsysinfo messages localizable

master
Ansariel 2015-07-31 15:28:22 +02:00
parent 051663674e
commit 83cd2e408f
6 changed files with 61 additions and 37 deletions

View File

@ -48,6 +48,7 @@
#include "llmutelist.h"
#include "llnotifications.h"
#include "llsdserialize.h"
#include "lltrans.h"
#include "llversioninfo.h"
#include "llviewercontrol.h"
#include "llviewermedia.h"
@ -835,25 +836,27 @@ void FSData::addAgents()
std::string FSData::processRequestForInfo(const LLUUID& requester, const std::string& message, const std::string& name, const LLUUID& sessionid)
{
std::string detectstring = "/reqsysinfo";
if(!message.find(detectstring) == 0)
const std::string detectstring = "/reqsysinfo";
if (message.find(detectstring) != 0)
{
return message;
}
if(!(isSupport(requester)||isDeveloper(requester)))
if (!isSupport(requester) && !isDeveloper(requester))
{
return message;
}
std::string outmessage("I am requesting information about your system setup.");
std::string outmessage = LLTrans::getString("Reqsysinfo_Chat_NoReason");
std::string reason("");
if(message.length() > detectstring.length())
if (message.length() > detectstring.length())
{
reason = std::string(message.substr(detectstring.length()));
//there is more to it!
outmessage = std::string("I am requesting information about your system setup for this reason : " + reason);
reason = "The reason provided was : " + reason;
reason = message.substr(detectstring.length());
LLStringUtil::format_map_t reason_args;
reason_args["REASON"] = reason;
outmessage = LLTrans::getString("Reqsysinfo_Chat_Reason", reason_args);
reason = LLTrans::getString("Reqsysinfo_Reason", reason_args);
}
LLSD args;
@ -867,19 +870,19 @@ std::string FSData::processRequestForInfo(const LLUUID& requester, const std::st
}
//static
void FSData::sendInfo(const LLUUID& destination, const LLUUID& sessionid, const std::string& myName, EInstantMessage dialog)
void FSData::sendInfo(const LLUUID& destination, const LLUUID& sessionid, const std::string& my_name, EInstantMessage dialog)
{
LLSD system_info = getSystemInfo();
std::string part1 = system_info["Part1"].asString();
std::string part2 = system_info["Part2"].asString();
const LLSD system_info = getSystemInfo();
const std::string part1 = system_info["Part1"].asString();
const std::string part2 = system_info["Part2"].asString();
pack_instant_message(
gMessageSystem,
gAgent.getID(),
gAgentID,
FALSE,
gAgent.getSessionID(),
gAgentSessionID,
destination,
myName,
my_name,
part1,
IM_ONLINE,
dialog,
@ -888,11 +891,11 @@ void FSData::sendInfo(const LLUUID& destination, const LLUUID& sessionid, const
gAgent.sendReliableMessage();
pack_instant_message(
gMessageSystem,
gAgent.getID(),
gAgentID,
FALSE,
gAgent.getSessionID(),
gAgentSessionID,
destination,
myName,
my_name,
part2,
IM_ONLINE,
dialog,
@ -900,8 +903,10 @@ void FSData::sendInfo(const LLUUID& destination, const LLUUID& sessionid, const
);
gAgent.sendReliableMessage();
gIMMgr->addMessage(gIMMgr->computeSessionID(dialog,destination),destination,myName,
"Information Sent: " + part1 + "\n" + part2);
LLStringUtil::format_map_t args;
args["DATA"] = part1 + "\n" + part2;
gIMMgr->addMessage(gIMMgr->computeSessionID(dialog, destination), destination, my_name,
LLTrans::getString("Reqsysinfo_Chat_Information_sent", args));
}
//static
@ -909,40 +914,39 @@ void FSData::callbackReqInfo(const LLSD &notification, const LLSD &response)
{
S32 option = LLNotification::getSelectedOption(notification, response);
std::string my_name;
LLSD subs = LLNotification(notification).getSubstitutions();
LLUUID uid = subs["FROMUUID"].asUUID();
LLSD subs = notification["substitutions"];
LLUUID uuid = subs["FROMUUID"].asUUID();
LLUUID sessionid = subs["SESSIONID"].asUUID();
LL_INFOS() << "the uuid is " << uid.asString().c_str() << LL_ENDL;
LLAgentUI::buildFullname(my_name);
if ( option == 0 )//yes
if (option == 0) //yes
{
sendInfo(uid,sessionid,my_name,IM_NOTHING_SPECIAL);
sendInfo(uuid, sessionid, my_name, IM_NOTHING_SPECIAL);
}
else
{
pack_instant_message(
gMessageSystem,
gAgent.getID(),
gAgentID,
FALSE,
gAgent.getSessionID(),
uid,
gAgentSessionID,
uuid,
my_name,
"Request Denied.",
"Request Denied.", // Left English intentionally as it gets sent to the support staff
IM_ONLINE,
IM_NOTHING_SPECIAL,
sessionid
);
gAgent.sendReliableMessage();
gIMMgr->addMessage(sessionid,uid,my_name,"Request Denied");
gIMMgr->addMessage(sessionid, uuid, my_name, LLTrans::getString("Reqsysinfo_Chat_Request_Denied"));
}
}
//static
LLSD FSData::getSystemInfo()
{
LLSD info=LLAppViewer::instance()->getViewerInfo();
LLSD info = LLAppViewer::instance()->getViewerInfo();
std::string sysinfo1("\n");
sysinfo1 += llformat("%s %s (%d) %s %s (%s) %s\n\n", LLAppViewer::instance()->getSecondLifeTitle().c_str(), LLVersionInfo::getShortVersion().c_str(), LLVersionInfo::getBuild(), info["BUILD_DATE"].asString().c_str(), info["BUILD_TIME"].asString().c_str(), LLVersionInfo::getChannel().c_str(),

View File

@ -49,7 +49,7 @@ public:
{
SUPPORT = (1 << 0), //0x01
DEVELOPER = (1 << 1), //0x02
QA = (1 << 2), //0x04
QA = (1 << 2), //0x04
CHAT_COLOR = (1 << 3), //0x08
NO_SUPPORT = (1 << 4), //0x16
NO_USE = (1 << 5), //0x32
@ -80,7 +80,7 @@ public:
private:
static void sendInfo(const LLUUID& destination, const LLUUID& sessionid, const std::string& myName, EInstantMessage dialog);
static void sendInfo(const LLUUID& destination, const LLUUID& sessionid, const std::string& my_name, EInstantMessage dialog);
void processAssets(const LLSD& assets);
void processAgents(const LLSD& data);
void saveLLSD(const LLSD& data, const std::string& filename, const LLDate& last_modified);

View File

@ -4499,10 +4499,10 @@ Dieses wird die folgenden Informationen an die aktuelle IM-Sitzung senden:
</notification>
<notification name="FireStormReqInfo">
[NAME] hat die eine Anfrage geschickt, Informationen über deine Firestorm-Konfiguration zu übermitteln.
(Dies sind dieselben Informationen, die unter Hilfe->INFO ÜBER Firestorm zu finden sind.)
[NAME] hat die eine Anfrage geschickt, Informationen über Ihre Firestorm-Konfiguration zu übermitteln.
(Dies sind dieselben Informationen, die unter Hilfe->Info über [APP_NAME] zu finden sind.)
[REASON]
Möchtest du diese Informationen übermitteln?
Möchten Sie diese Informationen übermitteln?
<form name="form">
<button name="Yes" text="Ja"/>
<button name="No" text="Nein"/>

View File

@ -6412,4 +6412,19 @@ Setzen Sie den Editorpfad in Anführungszeichen
<string name="Mute_Remove">
„[NAME]“ has been removed from the blocklist.
</string>
<string name="Reqsysinfo_Chat_NoReason">
Ich frage Informationen über Ihr System ab.
</string>
<string name="Reqsysinfo_Chat_Reason">
Ich frage aus folgendem Grund Informationen über Ihr System ab: [REASON]
</string>
<string name="Reqsysinfo_Chat_Information_sent">
Gesendete Intomationen: [DATA]
</string>
<string name="Reqsysinfo_Chat_Request_Denied">
Anfrage abgelehnt.
</string>
<string name="Reqsysinfo_Reason">
Der übermittelte Grund lautet: [REASON]
</string>
</strings>

View File

@ -9766,7 +9766,7 @@ This will send the following information to the current IM session:
name="FireStormReqInfo"
type="alertmodal">
[NAME] is requesting that you send them information about your Firestorm setup.
(This is the same information that can be found by going to Help->ABOUT Firestorm)
(This is the same information that can be found by going to Help->About [APP_NAME])
[REASON]
Would you like to send them this information?
<form name="form">

View File

@ -2863,4 +2863,9 @@ Try enclosing path to the editor with double quotes.
<string name="Mute_Add">'[NAME]' has been added to the blocklist.</string>
<string name="Mute_Remove">'[NAME]' has been removed from the blocklist.</string>
<string name="Reqsysinfo_Chat_NoReason">I am requesting information about your system setup.</string>
<string name="Reqsysinfo_Chat_Reason">I am requesting information about your system setup for this reason: [REASON]</string>
<string name="Reqsysinfo_Chat_Information_sent">Information Sent: [DATA]</string>
<string name="Reqsysinfo_Chat_Request_Denied">Request denied.</string>
<string name="Reqsysinfo_Reason">The reason provided was: [REASON]</string>
</strings>