dynamically by LDAPModifying "cn=config" automatically causes rebuilding
of the indices online in a background task.
.TP
+.BI maxentrysize \ <bytes>
+Specify the maximum size of an entry in bytes. Attempts to store
+an entry larger than this size will be rejected with the error
+LDAP_ADMINLIMIT_EXCEEDED. The default is 0, which is unlimited.
+.TP
.BI maxreaders \ <integer>
Specify the maximum number of threads that may have concurrent read access
to the database. Tools such as slapcat count as a single thread,
Debug( LDAP_DEBUG_TRACE,
LDAP_XSTRING(mdb_add) ": id2entry_add failed\n",
0, 0, 0 );
- rs->sr_err = LDAP_OTHER;
- rs->sr_text = "entry store failed";
+ if ( rs->sr_err == LDAP_ADMINLIMIT_EXCEEDED ) {
+ rs->sr_text = "entry is too big";
+ } else {
+ rs->sr_err = LDAP_OTHER;
+ rs->sr_text = "entry store failed";
+ }
goto return_results;
}
MDB_env *mi_dbenv;
/* DB_ENV parameters */
- /* The DB_ENV can be tuned via DB_CONFIG */
char *mi_dbenv_home;
uint32_t mi_dbenv_flags;
int mi_dbenv_mode;
size_t mi_mapsize;
ID mi_nextid;
+ size_t mi_maxentrysize;
slap_mask_t mi_defaultmask;
int mi_nattrs;
MDB_MAXREADERS,
MDB_MAXSIZE,
MDB_MODE,
- MDB_SSTACK
+ MDB_SSTACK,
+ MDB_MAXENTSZ
};
static ConfigTable mdbcfg[] = {
"DESC 'Attribute index parameters' "
"EQUALITY caseIgnoreMatch "
"SYNTAX OMsDirectoryString )", NULL, NULL },
+ { "maxentrysize", "size", 2, 2, 0, ARG_ULONG|ARG_MAGIC|MDB_MAXENTSZ,
+ mdb_cf_gen, "( OLcfgDbAt:12.3 NAME 'olcDbMaxEntrySize' "
+ "DESC 'Maximum size of an entry in bytes' "
+ "SYNTAX OMsInteger SINGLE-VALUE )", NULL, NULL },
{ "maxreaders", "num", 2, 2, 0, ARG_UINT|ARG_MAGIC|MDB_MAXREADERS,
mdb_cf_gen, "( OLcfgDbAt:12.1 NAME 'olcDbMaxReaders' "
"DESC 'Maximum number of threads that may access the DB concurrently' "
"MUST olcDbDirectory "
"MAY ( olcDbCheckpoint $ olcDbEnvFlags $ "
"olcDbNoSync $ olcDbIndex $ olcDbMaxReaders $ olcDbMaxsize $ "
- "olcDbMode $ olcDbSearchStack ) )",
+ "olcDbMode $ olcDbSearchStack $ olcDbMaxEntrySize ) )",
Cft_Database, mdbcfg },
{ NULL, 0, NULL }
};
c->value_int = mdb->mi_search_stack_depth;
break;
+ case MDB_MAXENTSZ:
+ c->value_ulong = mdb->mi_maxentrysize;
+ break;
+
case MDB_MAXREADERS:
c->value_int = mdb->mi_readers;
break;
case MDB_MAXSIZE:
break;
+ case MDB_MAXENTSZ:
+ mdb->mi_maxentrysize = 0;
+ break;
+
case MDB_CHKPT:
if ( mdb->mi_txn_cp_task ) {
struct re_s *re = mdb->mi_txn_cp_task;
mdb->mi_search_stack_depth = c->value_int;
break;
+ case MDB_MAXENTSZ:
+ mdb->mi_maxentrysize = c->value_ulong;
+ break;
+
case MDB_MAXREADERS:
mdb->mi_readers = c->value_int;
if ( mdb->mi_flags & MDB_IS_OPEN ) {
if (e->e_id < mdb->mi_nextid)
flag &= ~MDB_APPEND;
+ if (mdb->mi_maxentrysize && ec.len > mdb->mi_maxentrysize)
+ return LDAP_ADMINLIMIT_EXCEEDED;
+
again:
data.mv_size = ec.len;
if ( mc )
Debug( LDAP_DEBUG_TRACE,
LDAP_XSTRING(mdb_modify) ": id2entry update failed " "(%d)\n",
rs->sr_err, 0, 0 );
- rs->sr_text = "entry update failed";
+ if ( rs->sr_err == LDAP_ADMINLIMIT_EXCEEDED ) {
+ rs->sr_text = "entry too big";
+ } else {
+ rs->sr_err = LDAP_OTHER;
+ rs->sr_text = "entry update failed";
+ }
goto return_results;
}
"<=- " LDAP_XSTRING(mdb_modrdn)
": id2entry failed: %s (%d)\n",
mdb_strerror(rs->sr_err), rs->sr_err, 0 );
- rs->sr_err = LDAP_OTHER;
- rs->sr_text = "entry update failed";
+ if ( rs->sr_err == LDAP_ADMINLIMIT_EXCEEDED ) {
+ rs->sr_text = "entry too big";
+ } else {
+ rs->sr_err = LDAP_OTHER;
+ rs->sr_text = "entry update failed";
+ }
goto return_results;
}