diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llmessage/llmail.cpp | 27 |
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; | |||
66 | static apr_sockaddr_t* gSockAddr; | 65 | static apr_sockaddr_t* gSockAddr; |
67 | static apr_socket_t* gMailSocket; | 66 | static apr_socket_t* gMailSocket; |
68 | 67 | ||
69 | // According to RFC2822 | ||
70 | static const boost::regex valid_subject_chars("[\\x1-\\x9\\xb\\xc\\xe-\\x7f]*"); | ||
71 | bool connect_smtp(); | 68 | bool connect_smtp(); |
72 | void disconnect_smtp(); | 69 | void 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. | ||
174 | static 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 |
177 | std::string LLMail::buildSMTPTransaction( | 190 | std::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 | ||