mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-03-07 14:18:15 +08:00
Tweak back-mdb integer types to match libmdb.
Also do not cast between berval and MDB_val. That breaks when sizeof(berval.bv_len) != sizeof(MDB_val.mv_size).
This commit is contained in:
parent
0f1522418e
commit
141a43c1ee
@ -526,6 +526,7 @@ int mdb_ad_read( struct mdb_info *mdb, MDB_txn *txn )
|
||||
int i, rc;
|
||||
MDB_cursor *mc;
|
||||
MDB_val key, data;
|
||||
struct berval bdata;
|
||||
const char *text;
|
||||
AttributeDescription *ad;
|
||||
|
||||
@ -545,10 +546,12 @@ int mdb_ad_read( struct mdb_info *mdb, MDB_txn *txn )
|
||||
rc = mdb_cursor_get( mc, &key, &data, MDB_SET );
|
||||
|
||||
while ( rc == MDB_SUCCESS ) {
|
||||
bdata.bv_len = data.mv_size;
|
||||
bdata.bv_val = data.mv_data;
|
||||
ad = NULL;
|
||||
rc = slap_bv2ad( (struct berval *)&data, &ad, &text );
|
||||
rc = slap_bv2ad( &bdata, &ad, &text );
|
||||
if ( rc ) {
|
||||
rc = slap_bv2undef_ad( (struct berval *)&data, &mdb->mi_ads[i], &text, 0 );
|
||||
rc = slap_bv2undef_ad( &bdata, &mdb->mi_ads[i], &text, 0 );
|
||||
} else {
|
||||
mdb->mi_adxs[ad->ad_index] = i;
|
||||
mdb->mi_ads[i] = ad;
|
||||
@ -570,7 +573,7 @@ done:
|
||||
int mdb_ad_get( struct mdb_info *mdb, MDB_txn *txn, AttributeDescription *ad )
|
||||
{
|
||||
int i, rc;
|
||||
MDB_val key;
|
||||
MDB_val key, val;
|
||||
|
||||
rc = mdb_ad_read( mdb, txn );
|
||||
if (rc)
|
||||
@ -582,8 +585,10 @@ int mdb_ad_get( struct mdb_info *mdb, MDB_txn *txn, AttributeDescription *ad )
|
||||
i = mdb->mi_numads+1;
|
||||
key.mv_size = sizeof(int);
|
||||
key.mv_data = &i;
|
||||
val.mv_size = ad->ad_cname.bv_len;
|
||||
val.mv_data = ad->ad_cname.bv_val;
|
||||
|
||||
rc = mdb_put( txn, mdb->mi_ad2id, &key, (MDB_val *)&ad->ad_cname, 0 );
|
||||
rc = mdb_put( txn, mdb->mi_ad2id, &key, &val, 0 );
|
||||
if ( rc == MDB_SUCCESS ) {
|
||||
mdb->mi_adxs[ad->ad_index] = i;
|
||||
mdb->mi_ads[i] = ad;
|
||||
|
@ -60,7 +60,7 @@ static ConfigTable mdbcfg[] = {
|
||||
"DESC 'Attribute index parameters' "
|
||||
"EQUALITY caseIgnoreMatch "
|
||||
"SYNTAX OMsDirectoryString )", NULL, NULL },
|
||||
{ "maxreaders", "num", 2, 2, 0, ARG_INT|ARG_MAGIC|MDB_MAXREADERS,
|
||||
{ "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' "
|
||||
"SYNTAX OMsInteger SINGLE-VALUE )", NULL, NULL },
|
||||
|
@ -562,7 +562,7 @@ mdb_dn2id_children(
|
||||
|
||||
rc = mdb_cursor_get( cursor, &key, &data, MDB_SET );
|
||||
if ( rc == 0 ) {
|
||||
unsigned long dkids;
|
||||
size_t dkids;
|
||||
rc = mdb_cursor_count( cursor, &dkids );
|
||||
if ( rc == 0 ) {
|
||||
if ( dkids < 2 ) rc = MDB_NOTFOUND;
|
||||
|
@ -421,7 +421,7 @@ mdb_idl_insert_keys(
|
||||
memcpy(&lo, data.mv_data, sizeof(ID));
|
||||
if ( lo != 0 ) {
|
||||
/* not a range, count the number of items */
|
||||
unsigned long count;
|
||||
size_t count;
|
||||
rc = mdb_cursor_count( cursor, &count );
|
||||
if ( rc != 0 ) {
|
||||
err = "c_count";
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
static char presence_keyval[] = {0,0};
|
||||
static struct berval presence_key[2] = {BER_BVC(presence_keyval), BER_BVNULL};
|
||||
static MDB_val presence_mdbkey[2] = {{1, presence_keyval}, {0, NULL}};
|
||||
|
||||
AttrInfo *mdb_index_mask(
|
||||
Backend *be,
|
||||
@ -190,7 +191,7 @@ static int indexer(
|
||||
keyfunc = mdb_idl_delete_keys;
|
||||
|
||||
if( IS_SLAP_INDEX( mask, SLAP_INDEX_PRESENT ) ) {
|
||||
rc = keyfunc( mc, (MDB_val *)presence_key, id );
|
||||
rc = keyfunc( mc, presence_mdbkey, id );
|
||||
if( rc ) {
|
||||
err = "presence";
|
||||
goto done;
|
||||
|
Loading…
Reference in New Issue
Block a user