|
a/src/internfile/mh_mbox.cpp |
|
b/src/internfile/mh_mbox.cpp |
|
... |
|
... |
39 |
#include "md5.h"
|
39 |
#include "md5.h"
|
40 |
#include "conftree.h"
|
40 |
#include "conftree.h"
|
41 |
#include "ptmutex.h"
|
41 |
#include "ptmutex.h"
|
42 |
|
42 |
|
43 |
using namespace std;
|
43 |
using namespace std;
|
|
|
44 |
|
|
|
45 |
// Define maximum message size for safety. 100MB would seem reasonable
|
|
|
46 |
static const unsigned int max_mbox_member_size = 100 * 1024 * 1024;
|
|
|
47 |
|
44 |
class FpKeeper {
|
48 |
class FpKeeper {
|
45 |
public:
|
49 |
public:
|
46 |
FpKeeper(FILE **fpp) : m_fpp(fpp) {}
|
50 |
FpKeeper(FILE **fpp) : m_fpp(fpp) {}
|
47 |
~FpKeeper()
|
51 |
~FpKeeper()
|
48 |
{
|
52 |
{
|
|
... |
|
... |
275 |
if (m_config && m_config->getConfParam(cstr_keyquirks, quirks)) {
|
279 |
if (m_config && m_config->getConfParam(cstr_keyquirks, quirks)) {
|
276 |
if (quirks == "tbird") {
|
280 |
if (quirks == "tbird") {
|
277 |
LOGDEB(("MimeHandlerMbox: setting quirks TBIRD\n"));
|
281 |
LOGDEB(("MimeHandlerMbox: setting quirks TBIRD\n"));
|
278 |
m_quirks |= MBOXQUIRK_TBIRD;
|
282 |
m_quirks |= MBOXQUIRK_TBIRD;
|
279 |
}
|
283 |
}
|
|
|
284 |
}
|
|
|
285 |
|
|
|
286 |
// And double check for thunderbird
|
|
|
287 |
string tbirdmsf = fn + ".msf";
|
|
|
288 |
if ((m_quirks&MBOXQUIRK_TBIRD) == 0 && access(tbirdmsf.c_str(), 0) == 0) {
|
|
|
289 |
LOGDEB(("MimeHandlerMbox: detected unconfigured tbird mbox in %s\n",
|
|
|
290 |
fn.c_str()));
|
|
|
291 |
m_quirks |= MBOXQUIRK_TBIRD;
|
280 |
}
|
292 |
}
|
281 |
|
293 |
|
282 |
return true;
|
294 |
return true;
|
283 |
}
|
295 |
}
|
284 |
|
296 |
|
|
... |
|
... |
489 |
if (mtarg <= 0 || m_msgnum == mtarg) {
|
501 |
if (mtarg <= 0 || m_msgnum == mtarg) {
|
490 |
// Accumulate message lines
|
502 |
// Accumulate message lines
|
491 |
line[ll] = '\n';
|
503 |
line[ll] = '\n';
|
492 |
line[ll+1] = 0;
|
504 |
line[ll+1] = 0;
|
493 |
msgtxt += line;
|
505 |
msgtxt += line;
|
|
|
506 |
if (msgtxt.size() > max_mbox_member_size) {
|
|
|
507 |
LOGERR(("mh_mbox: huge message (more than %u MB) inside %s,"
|
|
|
508 |
" giving up\n", max_mbox_member_size/(1024*1024),
|
|
|
509 |
m_fn.c_str()));
|
|
|
510 |
return false;
|
|
|
511 |
}
|
494 |
}
|
512 |
}
|
495 |
}
|
513 |
}
|
496 |
LOGDEB2(("Message text length %d\n", msgtxt.size()));
|
514 |
LOGDEB2(("Message text length %d\n", msgtxt.size()));
|
497 |
LOGDEB2(("Message text: [%s]\n", msgtxt.c_str()));
|
515 |
LOGDEB2(("Message text: [%s]\n", msgtxt.c_str()));
|
498 |
char buf[20];
|
516 |
char buf[20];
|