OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
[patch] spamd cause core dump in convert_spamd_db

From: Olli Hauer (ohauergmx.de)
Date: Sun Mar 18 2007 - 08:45:43 CDT


I had some core dumps during convert from old 4.0 to new 4.1 db.

This fixed the core dump during convert.

--- /usr/src/libexec/spamd/grey.c-patch1 Sun Mar 18 13:24:13 2007
+++ /usr/src/libexec/spamd/grey.c Sun Mar 18 13:27:11 2007
-1088,7 +1088,7
         exit(1);
     }
     memset(&hashinfo, 0, sizeof(hashinfo));
- db2 = dbopen(sfn, O_EXLOCK|O_RDWR, 0600, DB_HASH, &hashinfo);
+ db2 = dbopen(sfn, O_EXLOCK|O_RDWR|O_CREAT, 0600, DB_HASH, &hashinfo);
     if (db2 == NULL) {
         unlink(sfn);
         syslog_r(LOG_ERR, &sdata,

Also it would be nice if spamdb create the db if not present and
action add was choosen.

--- /usr/src/usr.sbin/spamdb/spamdb.c.orig Tue Feb 27 17:22:11 2007
+++ /usr/src/usr.sbin/spamdb/spamdb.c Sun Mar 18 14:22:34 2007
-295,8 +295,8
         usage();
     
     memset(&hashinfo, 0, sizeof(hashinfo));
- db = dbopen(PATH_SPAMD_DB, O_EXLOCK | (action ? O_RDWR : O_RDONLY),
- 0600, DB_HASH, &hashinfo);
+ db = dbopen(PATH_SPAMD_DB, O_EXLOCK |
+ (action ? O_RDWR|O_CREAT : O_RDONLY), 0600, DB_HASH, &hashinfo);
     if (db == NULL) {
         if (errno == EFTYPE)
             err(1,

olli

--
"Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: www.gmx.net/de/go/mailfooter/topmail-out