Just a quick look into main.c, assuming it to be the most like suspect
wrt the parser bug.
Shouldn't we use getline instead of fgets? I've done a patch and it
looks ok in my tests.
Ilja Booij wrote:
I'v put this on the TODO list.
Anyway, we should really squash this last bug and move on to 2.0!
Problem is that I'll be really hard pressed for time the coming weeks so
it will really be helpful if everybody joins in to fix these strange
characters appearing in emails and the empty mail bodies.
Ilja
On Wed, 2004-04-14 at 16:41, Jesse Norell wrote:
Hello,
I've not been following this thread terribly closely, but does dbmail
allow messages with null's to be inserted properly? rfc 2822 allows
nulls within the message body, so if there were some in the original
message, and dbmail-{s,l}mtp allowed those to be inserted properly,
the behavior described below would cause incomplete messages to be
returned. I think the Right Thing(tm) is to allow nulls to be contained
in the message and returned just as the original message was - but I
know that gets ugly in C. Definitely put it on the future todo list
if nothing else...
---- Original Message ----
From: Ilja Booij <dbmail-dev@dbmail.org>
To: DBMAIL Developers Mailinglist <dbmail-dev@dbmail.org>
Subject: Re: [Dbmail-dev] parser bug
Sent: Wed, 14 Apr 2004 14:39:36 +0200
On Wed, 2004-04-14 at 14:13, Paul J Stevens wrote:
<snip info page>
So, if the row contains nulls, or db_get_length return value bigger than the
actual string length, msgbuf_buf is filled with nulls, correct?
I guess you're right :)
So, we should take the length of the string with strlen(), which would
result in the length up to the first NUL character, and use only that
part, and not send the NUL characters themselves.
This seems like logical behaviour, even though at first it's only a
workaround for our current problem.
Ilja
_______________________________________________
Dbmail-dev mailing list
Dbmail-dev@dbmail.org
http://twister.fastxs.net/mailman/listinfo/dbmail-dev
-- End Original Message --
--
Jesse Norell
[EMAIL PROTECTED] is not my email address;
change "administrator" to my first name.
--
_______________________________________________
Dbmail-dev mailing list
Dbmail-dev@dbmail.org
http://twister.fastxs.net/mailman/listinfo/dbmail-dev
_______________________________________________
Dbmail-dev mailing list
Dbmail-dev@dbmail.org
http://twister.fastxs.net/mailman/listinfo/dbmail-dev
--
________________________________________________________________
Paul Stevens mailto:[EMAIL PROTECTED]
NET FACILITIES GROUP PGP: finger [EMAIL PROTECTED]
The Netherlands________________________________http://www.nfg.nl
Index: header.c
===================================================================
RCS file: /cvsroot-dbmail/dbmail/header.c,v
retrieving revision 1.9
diff -r1.9 header.c
26a27,29
> // gnu extensions are permitted
> #define _GNU_SOURCE 1
>
70c73,74
< size_t usedmem = 0, linemem = 0;
---
> size_t usedmem = 0;
> ssize_t linemem = 0;
76d79
< memtst((tmpline = (char *) my_malloc(MAX_LINE_SIZE)) == NULL);
79d81
< memset(tmpline, '\0', MAX_LINE_SIZE);
87c89,91
<
---
>
> size_t linesize = MAX_LINE_SIZE;
>
89,92c93,105
< /* fgets will read until \n occurs, and \n is *included* in tmpline */
< if (!fgets(tmpline, MAX_LINE_SIZE, instream))
< break;
< linemem = strlen(tmpline);
---
> /* reset tmpline to null pointer and let getline
> * handle allocation */
> tmpline = 0;
> linemem = getline(&tmpline, &linesize, instream);
> if (linemem == -1) {
> trace(TRACE_ERROR, "%s,%s: error on instream",
> __FILE__,__FUNCTION__);
> my_free(tmpline);
> my_free(tmpheader);
> /* NOTA BENE: Make sure that the caller knows to free
> * the header block even if there's been an error! */
> return 0;
> }
104,113d116
< if (ferror(instream)) {
< trace(TRACE_ERROR,
< "read_header(): error on instream: [%s]",
< strerror(errno));
< my_free(tmpline);
< my_free(tmpheader);
< /* NOTA BENE: Make sure that the caller knows to free
< * the header block even if there's been an error! */
< return 0;
< }
161,164d163
<
< /* Resetting strlen for tmpline */
< tmpline[0] = '\0';
< linemem = 0;