aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmessage/llmail.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-09-06 18:24:57 -0500
committerJacek Antonelli2008-09-06 18:25:07 -0500
commit798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch)
tree1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/llmessage/llmail.cpp
parentSecond Life viewer sources 1.20.15 (diff)
downloadmeta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.zip
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.gz
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.bz2
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.xz
Second Life viewer sources 1.21.0-RC
Diffstat (limited to '')
-rw-r--r--linden/indra/llmessage/llmail.cpp27
1 files changed, 20 insertions, 7 deletions
diff --git a/linden/indra/llmessage/llmail.cpp b/linden/indra/llmessage/llmail.cpp
index 659803a..8ae7206 100644
--- a/linden/indra/llmessage/llmail.cpp
+++ b/linden/indra/llmessage/llmail.cpp
@@ -42,10 +42,9 @@
42 42
43#include <string> 43#include <string>
44#include <sstream> 44#include <sstream>
45#include <boost/regex.hpp>
46 45
47#include "apr-1/apr_pools.h" 46#include "apr_pools.h"
48#include "apr-1/apr_network_io.h" 47#include "apr_network_io.h"
49 48
50#include "llapr.h" 49#include "llapr.h"
51#include "llbase32.h" // IM-to-email address 50#include "llbase32.h" // IM-to-email address
@@ -66,8 +65,6 @@ static apr_pool_t* gMailPool;
66static apr_sockaddr_t* gSockAddr; 65static apr_sockaddr_t* gSockAddr;
67static apr_socket_t* gMailSocket; 66static apr_socket_t* gMailSocket;
68 67
69// According to RFC2822
70static const boost::regex valid_subject_chars("[\\x1-\\x9\\xb\\xc\\xe-\\x7f]*");
71bool connect_smtp(); 68bool connect_smtp();
72void disconnect_smtp(); 69void disconnect_smtp();
73 70
@@ -173,6 +170,22 @@ void LLMail::enable(bool mail_enabled)
173 gMailEnabled = mail_enabled; 170 gMailEnabled = mail_enabled;
174} 171}
175 172
173// Test a subject line for RFC2822 compliance.
174static bool valid_subject_chars(const char *subject)
175{
176 for (; *subject != '\0'; subject++)
177 {
178 unsigned char c = *subject;
179
180 if (c == '\xa' || c == '\xd' || c > '\x7f')
181 {
182 return false;
183 }
184 }
185
186 return true;
187}
188
176// static 189// static
177std::string LLMail::buildSMTPTransaction( 190std::string LLMail::buildSMTPTransaction(
178 const char* from_name, 191 const char* from_name,
@@ -187,7 +200,7 @@ std::string LLMail::buildSMTPTransaction(
187 << " from address." << llendl; 200 << " from address." << llendl;
188 return std::string(); 201 return std::string();
189 } 202 }
190 if(! boost::regex_match(subject, valid_subject_chars)) 203 if(!valid_subject_chars(subject))
191 { 204 {
192 llinfos << "send_mail build_smtp_transaction reject: bad subject header: " 205 llinfos << "send_mail build_smtp_transaction reject: bad subject header: "
193 << "to=<" << to_address 206 << "to=<" << to_address
@@ -352,7 +365,7 @@ std::string LLMail::encryptIMEmailAddress(const LLUUID& from_agent_id,
352 std::string address = LLBase32::encode(encrypted, encrypted_size); 365 std::string address = LLBase32::encode(encrypted, encrypted_size);
353 366
354 // Make it more pretty for humans. 367 // Make it more pretty for humans.
355 LLString::toLower(address); 368 LLStringUtil::toLower(address);
356 369
357 delete [] encrypted; 370 delete [] encrypted;
358 371