
paul at nfg
Jan 27, 2009, 8:22 AM
Post #2 of 2
(665 views)
Permalink
|
|
Re: Segmentation fault in dbmail-users and dbmail-util
[In reply to]
|
|
Peter, your patch was merged and pushed to the mainline git branch for dbmail-2.2 thanks, Peter Hochgemuth wrote: > Hi all, > > sorry, but I have to repost my message from one and a half year ago. I > switched from my long running debian installation (patched 2.2.6-rc1) to > an Ubuntu 8.04 which installs dbmail version 2.2.9. I found the sqlite > implementation doing the same errors as in 2007! > > /etc/dbmail/dbmail.conf: > [DBMAIL] > driver = sqlite > db = /var/dbmail/mail.db > .... > > # dbmail-users -V > This is DBMail version 2.2.9 > .... > > # rm /var/dbmail/mail.db > # dbmail-users -x A -t B,C > [B] > [C] > Done > # dbmail-users -l > -- users -- > __@!internal_delivery_user!@__:x:1:0:0.00:0.00: > __public__:x:3:0:0.00:0.00: > anyone:x:2:0:0.00:0.00: > > -- forwards -- > Segmentation fault > # > > Please can some body fix this problem? > > Peter > > Reference - thread "Segmentation fault in dbmail-users and dbmail-util" > opend at 07 Aug 2007 11:43:17 +0200 > > Am Donnerstag, den 09.08.2007, 11:27 +0200 schrieb Peter Hochgemuth: >> Hi, >> >> I found the bug in the sqlite implementation of db_set_result_set() and >> fixed it. Maybe somebody can check this in into SVN. >> The patch is >> >> #! /bin/sh /usr/share/dpatch/dpatch-run >> ## 04_dbsqlite.dpatch by <Peter.Hochgemuth at pobox.com> >> ## >> ## All lines beginning with `## DP:' are a description of the patch. >> ## DP: >> ## DP: [segfault in auth_check_user_ext() using sqlite] after: >> ## DP: saveres = db_get_result_set(); >> ## DP: db_set_result_set(NULL); >> ## DP: ... >> ## DP: db_set_result_set(saveres); >> ## DP: the call to db_free_result() in db_set_result_set() cleared out >> the values referenced by db_get_result_set() >> ## DP: >> ## DP: remove memory leaks in db_free_result() >> ## DP: don't reuse lastq in db_query() since we dont know if the value >> is referenced by a db_get_result_set() >> >> @DPATCH@ >> diff -urNad dbmail-2.2.6-rc1.orig/modules/dbsqlite.c >> dbmail-2.2.6-rc1/modules/dbsqlite.c >> --- dbmail-2.2.6-rc1.orig/modules/dbsqlite.c 2007-07-14 >> 11:56:54.000000000 +0200 >> +++ dbmail-2.2.6-rc1/modules/dbsqlite.c 2007-08-09 09:27:38.000000000 >> +0200 >> @@ -289,8 +289,7 @@ >> { >> if (lastq) { >> if (lastq->resp) sqlite3_free_table(lastq->resp); >> - lastq->resp = 0; >> - lastq->rows = lastq->cols = 0; >> + free(lastq); >> } >> lastq = 0; >> >> @@ -328,14 +327,11 @@ >> char *errmsg; >> int res, retry=0; >> >> - if (lastq) { >> - if (lastq->resp) sqlite3_free_table(lastq->resp); >> - } else { >> - lastq = (struct qtmp *)malloc(sizeof(struct qtmp)); >> - if (!lastq) { >> - TRACE(TRACE_ERROR, "malloc failed: %s", strerror(errno)); >> - return -1; >> - } >> + db_free_result(); >> + lastq = (struct qtmp *)malloc(sizeof(struct qtmp)); >> + if (!lastq) { >> + TRACE(TRACE_ERROR, "malloc failed: %s", strerror(errno)); >> + return -1; >> } >> TRACE(TRACE_DEBUG,"%s", the_query); >> >> @@ -355,6 +351,7 @@ >> >> TRACE(TRACE_ERROR, "sqlite3_get_table failed: %s", errmsg); >> sqlite3_free(errmsg); >> + db_free_result(); >> return -1; >> } >> >> @@ -414,6 +411,5 @@ >> >> void db_set_result_set(void *the_result_set) >> { >> - db_free_result(); >> lastq = (struct qtmp *)the_result_set; >> } >> >> >> Am Mittwoch, den 08.08.2007, 00:03 -0700 schrieb Aaron Stone: >>> I rewrote auth_check_user_ext a little bit. I'll try to find time to put >>> the code through some testing this week and check it into SVN. >>> >>> Aaron >>> >> _______________________________________________ >> DBmail mailing list >> DBmail [at] dbmail >> https://mailman.fastxs.nl/mailman/listinfo/dbmail -- ________________________________________________________________ Paul Stevens paul at nfg.nl NET FACILITIES GROUP GPG/PGP: 1024D/11F8CD31 The Netherlands________________________________http://www.nfg.nl _______________________________________________ DBmail mailing list DBmail [at] dbmail https://mailman.fastxs.nl/mailman/listinfo/dbmail
|