Got it.
It was the From_ line at the beginning that kicked in the gmime mbox scanner.
Attached patch fixes this.
--
________________________________________________________________
Paul Stevens paul at nfg.nl
NET FACILITIES GROUP GPG/PGP: 1024D/11F8CD31
The Netherlands________________________________http://www.nfg.nl
>From a003c4151b9a5bab00715aec72c23d58750c1789 Mon Sep 17 00:00:00 2001
From: Paul J Stevens <[EMAIL PROTECTED]>
Date: Wed, 5 Dec 2007 10:06:12 +0100
Subject: avoid gmime mbox parser to prevent unwanted message truncation
---
check_dbmail.h | 20 ++++++++++++++++++++
check_dbmail_message.c | 11 +++++++++++
dbmail-message.c | 9 ++++-----
3 files changed, 35 insertions(+), 5 deletions(-)
diff --git a/check_dbmail.h b/check_dbmail.h
index 0bc567e..4177230 100644
--- a/check_dbmail.h
+++ b/check_dbmail.h
@@ -21,6 +21,25 @@ char *simple = "From nobody Wed Sep 14 16:47:48 2005\n"
" this is a test message\n"
"\n";
+char *simple_with_from = "From [EMAIL PROTECTED] Tue Dec 04 19:52:17 2007\n"
+ "X-Envelope-From: <[EMAIL PROTECTED]>\n"
+ "Received: from [127.0.0.1] (port=49353 helo=test11)\n"
+ " by centos.nowhere.com with smtp (Exim 4.63)\n"
+ " (envelope-from <[EMAIL PROTECTED]>)\n"
+ " id 1IzWJv-0000Ep-5f\n"
+ " for [EMAIL PROTECTED]; Tue, 04 Dec 2007 19:52:17 +0800\n"
+ "From: \"Wallace\" <[EMAIL PROTECTED]>\n"
+ "To: wallace <[EMAIL PROTECTED]>\n"
+ "Subject: Test 11\n"
+ "Message-Id: <[EMAIL PROTECTED]>\n"
+ "Date: Tue, 04 Dec 2007 19:52:16 +0800\n"
+ "\n"
+ "\n"
+ "This line works, however,\n"
+ "From what I know, this line gets truncated\n"
+ "This line gets truncated\n"
+ "This other line get truncated too\n";
+
char *rfc822 = "From nobody Wed Sep 14 16:47:48 2005\n"
"Content-Type: text/plain; charset=\"us-ascii\"\n"
"MIME-Version: 1.0\n"
@@ -656,3 +675,4 @@ char *multipart_mixed = "Received: from RAIVO (raivo.kisise [192.168.111.49])\n"
"------=_NextPart_000_0059_01C6E7E6.3275C0B0--\n"
"\n"
"\n";
+
diff --git a/check_dbmail_message.c b/check_dbmail_message.c
index a2704d8..e246e4f 100644
--- a/check_dbmail_message.c
+++ b/check_dbmail_message.c
@@ -232,6 +232,17 @@ START_TEST(test_dbmail_message_to_string)
g_string_free(s,TRUE);
g_free(result);
dbmail_message_free(m);
+
+ //
+ s = g_string_new(simple_with_from);
+ m = dbmail_message_new();
+ m = dbmail_message_init_with_string(m,s);
+ result = dbmail_message_to_string(m);
+ fail_unless(MATCH(s->str,result), "[%s] =! [%s]\n", s->str, result);
+ g_string_free(s,TRUE);
+ g_free(result);
+ dbmail_message_free(m);
+
}
END_TEST
diff --git a/dbmail-message.c b/dbmail-message.c
index 66b3139..f55a71b 100644
--- a/dbmail-message.c
+++ b/dbmail-message.c
@@ -330,7 +330,7 @@ static int _set_content_from_stream(struct DbmailMessage *self, GMimeStream *str
GMimeStream *fstream, *bstream, *mstream;
GMimeFilter *filter;
GMimeParser *parser;
- gchar *buf, *from;
+ gchar *buf, *from = NULL;
ssize_t getslen, putslen;
FILE *tmp;
int res = 0;
@@ -369,7 +369,7 @@ static int _set_content_from_stream(struct DbmailMessage *self, GMimeStream *str
while ((getslen = g_mime_stream_buffer_gets(bstream, buf, MESSAGE_MAX_LINE_SIZE)) > 0) {
if (firstline && strncmp(buf,"From ",5)==0)
- g_mime_parser_set_scan_from(parser,TRUE);
+ from = g_strdup(buf);
firstline=FALSE;
if ((type==DBMAIL_STREAM_LMTP) && (strncmp(buf,".\r\n",3)==0))
@@ -418,15 +418,14 @@ static int _set_content_from_stream(struct DbmailMessage *self, GMimeStream *str
case DBMAIL_MESSAGE:
TRACE(TRACE_DEBUG,"parse message");
self->content = GMIME_OBJECT(g_mime_parser_construct_message(parser));
- if (g_mime_parser_get_scan_from(parser)) {
- from = g_mime_parser_get_from(parser);
+ if (from) {
dbmail_message_set_internal_date(self, from);
g_free(from);
}
break;
case DBMAIL_MESSAGE_PART:
- TRACE(TRACE_DEBUG,"parse part");
+ TRACE(TRACE_DEBUG,"parse part");
self->content = GMIME_OBJECT(g_mime_parser_construct_part(parser));
break;
}
--
1.5.1
_______________________________________________
DBmail mailing list
[email protected]
https://mailman.fastxs.nl/mailman/listinfo/dbmail