diff options
author | Mark Palange <palange@lindenlab.com> | 2008-10-08 00:22:32 +0000 |
---|---|---|
committer | Mark Palange <palange@lindenlab.com> | 2008-10-08 00:22:32 +0000 |
commit | b807e3df990e6fad25cd0bca94d2959dac042b13 (patch) | |
tree | aa8b185cac406abe412d76d90a903b450191d84d /indra/llmessage | |
parent | 4296542cd062af425d7744c88d6dd2bd00daf532 (diff) |
merge r97380-98701 branches/viewer/viewer_1-21 (Viewer RC5 and security fixes) merge to trunk (for real)
Diffstat (limited to 'indra/llmessage')
-rw-r--r-- | indra/llmessage/llmessagetemplate.h | 2 | ||||
-rw-r--r-- | indra/llmessage/llmessagetemplateparser.cpp | 2 | ||||
-rw-r--r-- | indra/llmessage/lltemplatemessagebuilder.cpp | 1 | ||||
-rw-r--r-- | indra/llmessage/lltemplatemessagereader.cpp | 3 | ||||
-rw-r--r-- | indra/llmessage/lltemplatemessagereader.h | 1 | ||||
-rw-r--r-- | indra/llmessage/llurlrequest.cpp | 42 | ||||
-rw-r--r-- | indra/llmessage/message.cpp | 6 |
7 files changed, 29 insertions, 28 deletions
diff --git a/indra/llmessage/llmessagetemplate.h b/indra/llmessage/llmessagetemplate.h index 82421b1f5a..69040cc288 100644 --- a/indra/llmessage/llmessagetemplate.h +++ b/indra/llmessage/llmessagetemplate.h @@ -300,7 +300,7 @@ public: ~LLMessageTemplate() { for_each(mMemberBlocks.begin(), mMemberBlocks.end(), DeletePointer()); -} + } void addBlock(LLMessageBlock *blockp) { diff --git a/indra/llmessage/llmessagetemplateparser.cpp b/indra/llmessage/llmessagetemplateparser.cpp index 86662c5342..750c6a0180 100644 --- a/indra/llmessage/llmessagetemplateparser.cpp +++ b/indra/llmessage/llmessagetemplateparser.cpp @@ -528,7 +528,7 @@ LLMessageTemplate * LLTemplateParser::parseMessage(LLTemplateTokenizer & tokens) else if (tokens.want("UDPBlackListed")) { templatep->setDeprecation(MD_UDPBLACKLISTED); - } + } else if (tokens.want("NotDeprecated")) { // this is the default value, but it can't hurt to set it twice diff --git a/indra/llmessage/lltemplatemessagebuilder.cpp b/indra/llmessage/lltemplatemessagebuilder.cpp index 70c306c060..a721f2848c 100644 --- a/indra/llmessage/lltemplatemessagebuilder.cpp +++ b/indra/llmessage/lltemplatemessagebuilder.cpp @@ -60,7 +60,6 @@ LLTemplateMessageBuilder::~LLTemplateMessageBuilder() mCurrentSMessageData = NULL; } - // virtual void LLTemplateMessageBuilder::newMessage(const char *name) { diff --git a/indra/llmessage/lltemplatemessagereader.cpp b/indra/llmessage/lltemplatemessagereader.cpp index 822051d363..5016665343 100644 --- a/indra/llmessage/lltemplatemessagereader.cpp +++ b/indra/llmessage/lltemplatemessagereader.cpp @@ -791,7 +791,6 @@ bool LLTemplateMessageReader::isTrusted() const return mCurrentRMessageTemplate->getTrust() == MT_TRUST; } -//virtual bool LLTemplateMessageReader::isBanned(bool trustedSource) const { return mCurrentRMessageTemplate->isBanned(trustedSource); @@ -799,7 +798,7 @@ bool LLTemplateMessageReader::isBanned(bool trustedSource) const bool LLTemplateMessageReader::isUdpBanned() const { - return mCurrentRMessageTemplate->isUdpBanned(); + return mCurrentRMessageTemplate->isUdpBanned(); } //virtual diff --git a/indra/llmessage/lltemplatemessagereader.h b/indra/llmessage/lltemplatemessagereader.h index 268afa3ef6..df2c681f77 100644 --- a/indra/llmessage/lltemplatemessagereader.h +++ b/indra/llmessage/lltemplatemessagereader.h @@ -110,6 +110,7 @@ public: bool isTrusted() const; bool isBanned(bool trusted_source) const; bool isUdpBanned() const; + private: void getData(const char *blockname, const char *varname, void *datap, diff --git a/indra/llmessage/llurlrequest.cpp b/indra/llmessage/llurlrequest.cpp index ff6ec9f077..518e54b79c 100644 --- a/indra/llmessage/llurlrequest.cpp +++ b/indra/llmessage/llurlrequest.cpp @@ -503,27 +503,29 @@ static size_t headerCallback(void* data, size_t size, size_t nmemb, void* user) // Per HTTP spec the first header line must be the status line. if (!complete->haveHTTPStatus()) { - std::string::iterator end = header.end(); - std::string::iterator pos1 = std::find(header.begin(), end, ' '); - if (pos1 != end) ++pos1; - std::string::iterator pos2 = std::find(pos1, end, ' '); - if (pos2 != end) ++pos2; - std::string::iterator pos3 = std::find(pos2, end, '\r'); - - std::string version(header.begin(), pos1); - std::string status(pos1, pos2); - std::string reason(pos2, pos3); - - int statusCode = atoi(status.c_str()); - if (statusCode > 0) + if (header.substr(0,5) == "HTTP/") { - complete->httpStatus((U32)statusCode, reason); - } - else - { - llwarns << "Unable to parse http response status line: " - << header << llendl; - complete->httpStatus(499,"Unable to parse status line."); + std::string::iterator end = header.end(); + std::string::iterator pos1 = std::find(header.begin(), end, ' '); + if (pos1 != end) ++pos1; + std::string::iterator pos2 = std::find(pos1, end, ' '); + if (pos2 != end) ++pos2; + std::string::iterator pos3 = std::find(pos2, end, '\r'); + + std::string version(header.begin(), pos1); + std::string status(pos1, pos2); + std::string reason(pos2, pos3); + + int statusCode = atoi(status.c_str()); + if (statusCode >= 300 && statusCode < 400) + { + // This is a redirect, ignore it and all headers + // until we find a normal status code. + } + else if (statusCode > 0) + { + complete->httpStatus((U32)statusCode, reason); + } } return header_len; } diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp index abd9467602..dd7818c470 100644 --- a/indra/llmessage/message.cpp +++ b/indra/llmessage/message.cpp @@ -754,11 +754,12 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count ) clearReceiveState(); valid_packet = FALSE; } + if( valid_packet && mTemplateMessageReader->isUdpBanned()) { llwarns << "Received UDP black listed message " - << mTemplateMessageReader->getMessageName() - << " from " << host << llendl; + << mTemplateMessageReader->getMessageName() + << " from " << host << llendl; clearReceiveState(); valid_packet = FALSE; } @@ -766,7 +767,6 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count ) if( valid_packet ) { logValidMsg(cdp, host, recv_reliable, recv_resent, (BOOL)(acks>0) ); - valid_packet = mTemplateMessageReader->readMessage(buffer, host); } |