X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fback-bdb%2Fidl.c;h=1454e18f93967a9112d8e025db9bec0c2d1274cb;hb=282f6bc32d942d866edde41e8c35a96ae5b040c5;hp=3e5064463828f772b84158dca48d0a1db48fbea3;hpb=cca15d41c90698a5d0e0559b236107d7dc5171e2;p=openldap diff --git a/servers/slapd/back-bdb/idl.c b/servers/slapd/back-bdb/idl.c index 3e50644638..1454e18f93 100644 --- a/servers/slapd/back-bdb/idl.c +++ b/servers/slapd/back-bdb/idl.c @@ -304,15 +304,22 @@ bdb_idl_fetch_key( bdb_idl_cache_entry_t idl_tmp; #endif - /* buf must be large enough to grab the entire IDL in one - * get(), otherwise BDB 4 will leak resources on subsequent - * get's. We can safely call get() twice - once for the data, - * and once to get the DB_NOTFOUND result meaning there's - * no more data. See ITS#2040 for details. This bug is fixed - * in BDB 4.1 so a smaller buffer will work if stack space is - * too limited. + /* If using BerkeleyDB 4.0, the buf must be large enough to + * grab the entire IDL in one get(), otherwise BDB will leak + * resources on subsequent get's. We can safely call get() + * twice - once for the data, and once to get the DB_NOTFOUND + * result meaning there's no more data. See ITS#2040 for details. + * This bug is fixed in BDB 4.1 so a smaller buffer will work if + * stack space is too limited. + * + * configure now requires Berkeley DB 4.1. */ - ID buf[BDB_IDL_DB_SIZE*5]; +#if (DB_VERSION_MAJOR == 4) && (DB_VERSION_MINOR == 0) +# define BDB_ENOUGH 5 +#else +# define BDB_ENOUGH 1 +#endif + ID buf[BDB_IDL_DB_SIZE*BDB_ENOUGH]; char keybuf[16];