Hello All,

Thanks for you good work... i've been testing 2.1.5 with mysql 5.0.19,
with a view to rolling it out and have found some issues.

I too have been experiencing segfaults in dbmail-smtp.  Setup is gentoo
linux 2.6.15, fresh install of everything.  Using qmail as the mta.

Here's the gdb session with the latest code.

> tail -f /var/log/messages &
>
> # gdb dbmail-smtp
> GNU gdb 6.4
> Copyright 2005 ...
> This GDB was configured as "i686-pc-linux-gnu"...Using host
> libthread_db library "/lib/tls/libthread_db.so.1".
>
> (gdb) run -d [EMAIL PROTECTED]
> Starting program: /usr/local/sbin/dbmail-smtp -d [EMAIL PROTECTED]
> [Thread debugging using libthread_db enabled]
> [New Thread -1211423040 (LWP 24458)]
> --- PASTING THIS IN...
> From - Wed Feb 09 17:03:05 2005
> Return-path: <[EMAIL PROTECTED]>
> Envelope-to: [EMAIL PROTECTED]
> Delivery-date: Thu, 02 Dec 2004 09:58:37 -0500
> Received: from bambam.phgroup.com ([192.168.1.34] helo=phgroup.com)
>         by mail.phgroup.com with esmtp (Exim 3.36 #1)
>         id 1CZsPl-00024u-00
>         for [EMAIL PROTECTED]; Thu, 02 Dec 2004 14:58:37 +0000
> Message-ID: <[EMAIL PROTECTED]>
> Date: Thu, 02 Dec 2004 14:58:36 +0000
> From: Mojgan Farhadi <[EMAIL PROTECTED]>
> User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-GB; rv:1.6)
> Gecko/20040113
> X-Accept-Language: en-gb, en
> MIME-Version: 1.0
> To:  [EMAIL PROTECTED]
> Subject: test
> Content-Type: text/plain; charset=us-ascii; format=flowed
> Content-Transfer-Encoding: 7bit
>
> freddie,
> dont ...
> --- end of pasting.
> sort.c, sort_deliver_to_mailbox: message id=62, size=875 is inserted
>
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread -1211423040 (LWP 24458)]
> 0xb7d33869 in free () from /lib/tls/libc.so.6
> 0xb7ceb869 in free () from /lib/tls/libc.so.6
> (gdb) where
> #0  0xb7ceb869 in free () from /lib/tls/libc.so.6
> #1  0xb7e06d66 in g_free () from /usr/lib/libglib-2.0.so.0
> #2  0xb7e06d4c in g_free () from /usr/lib/libglib-2.0.so.0
> #3  0xb7db43d7 in dm_list_free (start=0x8052ad8) at list.c:45
> #4  0xb7dc77b0 in dsnuser_free (dsnuser=0x804b6e0) at dsn.c:232
> #5  0x08049313 in main (argc=352, argv=0x8049b4d) at main.c:405
the following is from the tail on mesages.
> Apr  9 23:09:17 mail2 dbmail/smtp[24458]:
> mime.c,mail_address_build_list: mail address parser starting
> Apr  9 23:09:17 mail2 dbmail/smtp[24458]: dsn.c, dsnuser_resolve:
> checking if [EMAIL PROTECTED] is a valid username, alias, or
> catchall.
> Apr  9 23:09:17 mail2 dbmail/smtp[24458]: dsn.c, dsnuser_resolve:
> delivering [EMAIL PROTECTED] as an alias.
> Apr  9 23:09:17 mail2 dbmail/smtp[24458]: misc.c, find_bounded: Found
> nothing between '+' and '@'
> Apr  9 23:09:17 mail2 dbmail/smtp[24458]: sort.c,
> sort_deliver_to_mailbox: message id=62, size=875 is inserted
> Apr  9 23:09:17 mail2 dbmail/smtp[24458]: sort.c, sort_and_deliver:
> Keep was not cancelled. Message will be delivered by default.
>
The message actually gets delivered, thunderbird sees it.

list.c: 45 is
>         g_free((*start)->data);
dsn.c:232 is
>           dm_list_free(&dsnuser->userids->start);
main.c: 405 is
>         dsnuser_free(&dsnuser);

------------------------
Things already tried :

I had found in a previous gdb session that there is a problem with some
free() calls in dsn.c and added the following patches

. ... -> start is sometimes NULL, so...

diff -u ../tmp/dbmail-2.1.5/dsn.c dsn.c
--- ../tmp/dbmail-2.1.5/dsn.c   2006-03-01 21:02:57.000000000 +0000
+++ dsn.c       2006-04-09 21:07:22.000000000 +0000
@@ -228,8 +228,12 @@
        dsnuser->mailbox = NULL;
        dsnuser->source = BOX_NONE;

-       dm_list_free(&dsnuser->userids->start);
-       dm_list_free(&dsnuser->forwards->start);
+       if ( &dsnuser->userids->start ) {
+         dm_list_free(&dsnuser->userids->start);
+       }
+       if ( &dsnuser->forwards->start ) {
+         dm_list_free(&dsnuser->forwards->start);
+       }

        dm_free(dsnuser->mailbox);
        dm_free(dsnuser->userids);


I had also already applied the patch found on this list (aimed at
avoiding segfaults)

diff -u dbmail-message.c~ dbmail-message.c
--- dbmail-message.c~   2006-02-17 22:21:52.000000000 +0000
+++ dbmail-message.c    2006-04-09 20:02:23.000000000 +0000
@@ -163,6 +163,9 @@

void dbmail_message_free(struct DbmailMessage *self)
{
+  if (!self) {
+    return;
+  }
        if (self->headers)
                g_relation_destroy(self->headers);
        if (self->content)


and finally i had provided a default for the deliver_to_header variable
in main.c (via reading changelogs and looking at the svn snapshot):

# diff -u  main.c~ main.c
--- main.c~     2006-04-09 20:33:40.000000000 +0000
+++ main.c      2006-04-09 20:41:19.000000000 +0000
@@ -116,7 +116,10 @@
                                } else {
                                        deliver_to_header = optarg;
                                }
-                       }
+                       }
+                       /* these 2 lines added by fve */
+                       else
+                               deliver_to_header = "delivered_to";

                        break;

----------
So, my questions are :

1. what's the right thing between 'deliver-to' vs 'delivered-to' ?  it
sounds like we should use 'delivered-to', but the changelogs say the
most recent change is towards 'deliver-to', and svn snapshots have this too.

2. can we easily stop this segfaulting ?

This segfaulting doesn't happen with 2.1.3, where the relevant code is
similal (i.e. no checking for nulls, but it just works.)  ah well.

Many thanks again,

-f




--
Frederic Vander Elst

Reply via email to