#ifdef BDB_IDL_MULTI
{
DBC *cursor;
- ID buf[BDB_PAGESIZE*4];
+ /* 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.
+ */
+ ID buf[BDB_IDL_DB_SIZE*5];
ID *i;
void *ptr;
size_t len;
err = "c_count";
goto fail;
}
- if ( count >= BDB_IDL_DB_SIZE ) {
+ if ( count >= BDB_IDL_DB_MAX ) {
/* No room, convert to a range */
DBT key2 = *key;
-/* back-bdb.h - ldap ldbm back-end header file */
+/* back-bdb.h - ldap bdb back-end header file */
/* $OpenLDAP$ */
/*
* Copyright 2000-2002 The OpenLDAP Foundation, All Rights Reserved.
#ifndef _BDB_IDL_H_
#define _BDB_IDL_H_
-#include <portable.h>
-
-#include "slap.h"
-
/* IDL sizes - likely should be even bigger
* limiting factors: sizeof(ID), thread stack size
- *
- * Note: the -2 stuff is intended to reduce the size
- * just enough to avoiding internal (to malloc) allocation
- * of overly large blocks to provide the requested size.
- * The stuff needs to be thought out better, doesn't deal
- * well with mixed stack/malloc allocation of IDLs.
*/
-#define BDB_IDL_DB_SIZE ((1<<16)-2) /* 32K IDL on disk */
-#define BDB_IDL_UM_SIZE ((1<<17)-2) /* 64K IDL in memory */
+#define BDB_IDL_DB_SIZE (1<<16) /* 64K IDL on disk */
+#define BDB_IDL_UM_SIZE (1<<17) /* 128K IDL in memory */
#define BDB_IDL_UM_SIZEOF (BDB_IDL_UM_SIZE * sizeof(ID))
-#define BDB_IDL_DB_MAX (BDB_IDL_DB_SIZE-2)
-/* #define BDB_IDL_DB_ALLOC (BDB_IDL_DB_SIZE * sizeof(ID)) */
+#define BDB_IDL_DB_MAX (BDB_IDL_DB_SIZE-1)
-#define BDB_IDL_UM_MAX (BDB_IDL_UM_SIZE-2)
-/* #define BDB_IDL_UM_ALLOC (BDB_IDL_UM_SIZE * sizeof(ID)) */
+#define BDB_IDL_UM_MAX (BDB_IDL_UM_SIZE-1)
#define BDB_IDL_IS_RANGE(ids) ((ids)[0] == NOID)
#define BDB_IDL_RANGE_SIZE (3)