OSEC

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

From: Bob Beck (beckbofh.cns.ualberta.ca)
Date: Sun Mar 18 2007 - 13:33:23 CDT


* Olli Hauer <ohauergmx.de> [2007-03-18 08:00]:
> 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,
>

        funny, I've never gotten a crash from this. Got your core file?
I'd like to see. because sfn is already there and should NOT need to
be created as it's already there from mkstemp.

>
> 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,

        No. sorry, spamd creates the database if it is not there. spamdb
does not. if you are running spamdb with no database there, you are
doing something wrong - it should error out, as it does.