X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/2b1c6e3a3a41b680dcefcb87d6c373431f718607..261dc43e32f6039781ca92535e56f5caaa68b809:/src/src/dbstuff.h diff --git a/src/src/dbstuff.h b/src/src/dbstuff.h index 2b51b0ba8..94c9b97ad 100644 --- a/src/src/dbstuff.h +++ b/src/src/dbstuff.h @@ -1,10 +1,10 @@ -/* $Cambridge: exim/src/src/dbstuff.h,v 1.5 2006/09/05 13:24:10 ph10 Exp $ */ +/* $Cambridge: exim/src/src/dbstuff.h,v 1.9 2009/11/16 19:50:36 nm4 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * *************************************************/ -/* Copyright (c) University of Cambridge 1995 - 2006 */ +/* Copyright (c) University of Cambridge 1995 - 2009 */ /* See the file NOTICE for conditions of use and distribution. */ /* This header file contains macro definitions so that a variety of DBM @@ -135,7 +135,7 @@ API changed for DB 4.1. */ #define EXIM_DBOPEN(name, flags, mode, dbpp) \ if (db_create(dbpp, NULL, 0) != 0 || \ ((*dbpp)->set_errcall(*dbpp, dbfn_bdb_error_callback), \ - (*dbpp)->open(*dbpp, NULL, CS name, NULL, \ + ((*dbpp)->open)(*dbpp, NULL, CS name, NULL, \ ((flags) == O_RDONLY)? DB_UNKNOWN : DB_HASH, \ ((flags) == O_RDONLY)? DB_RDONLY : DB_CREATE, \ mode)) != 0) *(dbpp) = NULL @@ -143,7 +143,7 @@ API changed for DB 4.1. */ #define EXIM_DBOPEN(name, flags, mode, dbpp) \ if (db_create(dbpp, NULL, 0) != 0 || \ ((*dbpp)->set_errcall(*dbpp, dbfn_bdb_error_callback), \ - (*dbpp)->open(*dbpp, CS name, NULL, \ + ((*dbpp)->open)(*dbpp, CS name, NULL, \ ((flags) == O_RDONLY)? DB_UNKNOWN : DB_HASH, \ ((flags) == O_RDONLY)? DB_RDONLY : DB_CREATE, \ mode)) != 0) *(dbpp) = NULL @@ -300,6 +300,17 @@ before use, but we don't have to free anything after reading data. */ /* Some text for messages */ #define EXIM_DBTYPE "db (v1)" +/* When scanning, for the non-first case we historically just passed 0 +as the flags field and it worked. On FreeBSD 8 it no longer works and +instead leads to memory exhaustion. The man-page on FreeBSD says to use +R_NEXT, but this 1.x is a historical fallback and I've no idea how portable +the use of that flag is; so the solution is to define R_NEXT here if it's not +already defined, with a default value of 0 because that's what we've always +before been able to pass successfully. */ +#ifndef R_NEXT +#define R_NEXT 0 +#endif + /* Access functions */ /* EXIM_DBOPEN - sets *dbpp to point to an EXIM_DB, NULL if failed */ @@ -331,7 +342,7 @@ before use, but we don't have to free anything after reading data. */ /* EXIM_DBSCAN - returns TRUE if data is returned, FALSE at end */ #define EXIM_DBSCAN(db, key, data, first, cursor) \ - ((db)->seq(db, &key, &data, (first? R_FIRST : 0)) == 0) + ((db)->seq(db, &key, &data, (first? R_FIRST : R_NEXT)) == 0) /* EXIM_DBDELETE_CURSOR - terminate scanning operation (null). Make it refer to cursor, to keep picky compilers happy. */