Mailing List Archive

Delivery status in pipe and getopt support in main.. again
Hi all,

starting a new thread here, I kind of lost track of the previous one and
might have deleted some emails that I should not have deleted...

Anyway, I applied the latest set of patches made by Aaron.
Most stuff seems to work, but there is some stuff that is not working.

When I take a test-message and send that using
dbmail-smtp -n (using Deliver-To: <address> in the message)
dbmail segfaults. It segfaults on freeing the users list

(line 340 of main.c: list_freelist(users.start);)

There are two other things (these were already there before applying
Aaron's patches:

* the read_header() function in header.c seems to hang on an fgets().
* dbmail sometimes segfaults on the delivery of a message (another
segfault than the one mentioned above)

Ilja
Re: Delivery status in pipe and getopt support in main.. again [ In reply to ]
Oops! There's a double free. When the list of raw addresses from
mail_adr_list() is copied into dsnusers list by wrapping each addresses into a
dsn structure, the address pointer is pointed into the address list rather
than actually copied. So dsnuser_free() and list_freelist() both free the address.

The simple fix is to strdup() the address. A more involved fix is to have a
flag that lets dsnuser_free() know if it owns the address pointer or not. I'm
inclined to go with the former; a patch is posted on SourceForge.

Thanks for committing the patch!

Aaron


Ilja Booij <ilja@ic-s.nl> said:

> Hi all,
>
> starting a new thread here, I kind of lost track of the previous one and
> might have deleted some emails that I should not have deleted...
>
> Anyway, I applied the latest set of patches made by Aaron.
> Most stuff seems to work, but there is some stuff that is not working.
>
> When I take a test-message and send that using
> dbmail-smtp -n (using Deliver-To: <address> in the message)
> dbmail segfaults. It segfaults on freeing the users list
>
> (line 340 of main.c: list_freelist(users.start);)
>
> There are two other things (these were already there before applying
> Aaron's patches:
>
> * the read_header() function in header.c seems to hang on an fgets().
> * dbmail sometimes segfaults on the delivery of a message (another
> segfault than the one mentioned above)
>
> Ilja
>
> _______________________________________________
> Dbmail-dev mailing list
> Dbmail-dev@dbmail.org
> http://twister.fastxs.net/mailman/listinfo/dbmail-dev
>



--
Re: Delivery status in pipe and getopt support in main.. again [ In reply to ]
Hi,

I guess I've found a reason why I got crashes and you didn't. I
triggered a bug in bounce.c, because I was trying to send mail to a user
whose mailbox would overflow. The trace message which logs the reason of
the bounce had a typo, missing a comma between the "string" and the
__FILE__ argument. Adding the comma did the trick.

There is a way to let the compiler find these kinds of errors at compile
time (some GNU extension). I'll look for it, because there's bound to be
more errors like this, now or in the future.

Another thing: Remove -fomit-frame-pointer from AM_CFLAGS in Makefile.am
and run automake if you need to do debugging.. I had a hard time with
gdb before realizing that I needed to do this.. :(

Ilja

Aaron Stone wrote:
> Oops! There's a double free. When the list of raw addresses from
> mail_adr_list() is copied into dsnusers list by wrapping each addresses into a
> dsn structure, the address pointer is pointed into the address list rather
> than actually copied. So dsnuser_free() and list_freelist() both free the address.
>
> The simple fix is to strdup() the address. A more involved fix is to have a
> flag that lets dsnuser_free() know if it owns the address pointer or not. I'm
> inclined to go with the former; a patch is posted on SourceForge.
>
> Thanks for committing the patch!
>
> Aaron
>
>
> Ilja Booij <ilja@ic-s.nl> said:
>
>
>>Hi all,
>>
>>starting a new thread here, I kind of lost track of the previous one and
>>might have deleted some emails that I should not have deleted...
>>
>>Anyway, I applied the latest set of patches made by Aaron.
>>Most stuff seems to work, but there is some stuff that is not working.
>>
>>When I take a test-message and send that using
>>dbmail-smtp -n (using Deliver-To: <address> in the message)
>>dbmail segfaults. It segfaults on freeing the users list
>>
>>(line 340 of main.c: list_freelist(users.start);)
>>
>>There are two other things (these were already there before applying
>>Aaron's patches:
>>
>>* the read_header() function in header.c seems to hang on an fgets().
>>* dbmail sometimes segfaults on the delivery of a message (another
>>segfault than the one mentioned above)
>>
>>Ilja
>>
>>_______________________________________________
>>Dbmail-dev mailing list
>>Dbmail-dev@dbmail.org
>>http://twister.fastxs.net/mailman/listinfo/dbmail-dev
>>
>
>
>
>
Re: Delivery status in pipe and getopt support in main.. again [ In reply to ]
I just tried half a dozen -W...format... variations and could not get this
error reported :-\ Looks like the problem is GCC doesn't believe that trace()
is in the printf() family. Convince it of that, and the errors should abound.

Turn on -pedantic and -std=c99 to get some interesting warnings, though!

Aaron


Ilja Booij <ilja@ic-s.nl> said:

> Hi,
>
> I guess I've found a reason why I got crashes and you didn't. I
> triggered a bug in bounce.c, because I was trying to send mail to a user
> whose mailbox would overflow. The trace message which logs the reason of
> the bounce had a typo, missing a comma between the "string" and the
> __FILE__ argument. Adding the comma did the trick.
>
> There is a way to let the compiler find these kinds of errors at compile
> time (some GNU extension). I'll look for it, because there's bound to be
> more errors like this, now or in the future.
>
> Another thing: Remove -fomit-frame-pointer from AM_CFLAGS in Makefile.am
> and run automake if you need to do debugging.. I had a hard time with
> gdb before realizing that I needed to do this.. :(
>
> Ilja
>
> Aaron Stone wrote:
> > Oops! There's a double free. When the list of raw addresses from
> > mail_adr_list() is copied into dsnusers list by wrapping each addresses into a
> > dsn structure, the address pointer is pointed into the address list rather
> > than actually copied. So dsnuser_free() and list_freelist() both free the
address.
> >
> > The simple fix is to strdup() the address. A more involved fix is to have a
> > flag that lets dsnuser_free() know if it owns the address pointer or not. I'm
> > inclined to go with the former; a patch is posted on SourceForge.
> >
> > Thanks for committing the patch!
> >
> > Aaron
> >
> >
> > Ilja Booij <ilja@ic-s.nl> said:
> >
> >
> >>Hi all,
> >>
> >>starting a new thread here, I kind of lost track of the previous one and
> >>might have deleted some emails that I should not have deleted...
> >>
> >>Anyway, I applied the latest set of patches made by Aaron.
> >>Most stuff seems to work, but there is some stuff that is not working.
> >>
> >>When I take a test-message and send that using
> >>dbmail-smtp -n (using Deliver-To: <address> in the message)
> >>dbmail segfaults. It segfaults on freeing the users list
> >>
> >>(line 340 of main.c: list_freelist(users.start);)
> >>
> >>There are two other things (these were already there before applying
> >>Aaron's patches:
> >>
> >>* the read_header() function in header.c seems to hang on an fgets().
> >>* dbmail sometimes segfaults on the delivery of a message (another
> >>segfault than the one mentioned above)
> >>
> >>Ilja
> >>
> >>_______________________________________________
> >>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
>



--
Re: Delivery status in pipe and getopt support in main.. again [ In reply to ]
I have all of the delivery bugs mentioned in the last few days worked out,
except for this one...

Ilja Booij <ilja@ic-s.nl> said:
[snip]
> starting a new thread here...
[snip]
> * the read_header() function in header.c seems to hang on an fgets().

So I don't see this one myself, is there a test case I can try?

> * dbmail sometimes segfaults on the delivery of a message (another
> segfault than the one mentioned above)

I believe that this was the missing command in bounce.c... Ilja fixed it.

Aaron

--