From a3346f969fe58e8b397e18fc075a6ba9c387c1e5 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Tue, 6 Sep 2011 17:23:41 -0700 Subject: [PATCH] More error msgs --- servers/slapd/back-mdb/attr.c | 13 ++++++++++++- servers/slapd/back-mdb/id2entry.c | 12 ++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/servers/slapd/back-mdb/attr.c b/servers/slapd/back-mdb/attr.c index ade5834fee..9b7a4a9772 100644 --- a/servers/slapd/back-mdb/attr.c +++ b/servers/slapd/back-mdb/attr.c @@ -530,8 +530,12 @@ int mdb_ad_read( struct mdb_info *mdb, MDB_txn *txn ) AttributeDescription *ad; rc = mdb_cursor_open( txn, mdb->mi_ad2id, &mc ); - if ( rc ) + if ( rc ) { + Debug( LDAP_DEBUG_ANY, + "mdb_ad_read: cursor_open failed %s(%d)\n", + mdb_strerror(rc), rc, 0); return rc; + } /* our array is 1-based, an index of 0 means no data */ i = mdb->mi_numads+1; @@ -569,6 +573,9 @@ int mdb_ad_get( struct mdb_info *mdb, MDB_txn *txn, AttributeDescription *ad ) MDB_val key; rc = mdb_ad_read( mdb, txn ); + if (rc) + return rc; + if ( mdb->mi_adxs[ad->ad_index] ) return 0; @@ -581,6 +588,10 @@ int mdb_ad_get( struct mdb_info *mdb, MDB_txn *txn, AttributeDescription *ad ) mdb->mi_adxs[ad->ad_index] = i; mdb->mi_ads[i] = ad; mdb->mi_numads++; + } else { + Debug( LDAP_DEBUG_ANY, + "mdb_ad_get: mdb_put failed %s(%d)\n", + mdb_strerror(rc), rc, 0); } return rc; diff --git a/servers/slapd/back-mdb/id2entry.c b/servers/slapd/back-mdb/id2entry.c index d3aa0c07ef..24e934cf47 100644 --- a/servers/slapd/back-mdb/id2entry.c +++ b/servers/slapd/back-mdb/id2entry.c @@ -42,12 +42,18 @@ static int mdb_id2entry_put( rc = mdb_entry_encode( op, tid, e, &data ); if( rc != LDAP_SUCCESS ) { - return -1; + return LDAP_OTHER; } rc = mdb_put( tid, dbi, &key, &data, flag ); - op->o_tmpfree( data.mv_data, op->o_tmpmemctx ); + if (rc) { + Debug( LDAP_DEBUG_ANY, + "mdb_id2entry_put: mdb_put failed: %s(%d) \"%s\"\n", + mdb_strerror(rc), rc, + e->e_nname.bv_val ); + rc = LDAP_OTHER; + } return rc; } @@ -482,6 +488,7 @@ static int mdb_entry_partsize(struct mdb_info *mdb, MDB_txn *txn, Entry *e, eh->bv.bv_len = len; eh->nattrs = nat; eh->nvals = nval; + return 0; } /* Flatten an Entry into a buffer. The buffer is filled with just the @@ -507,6 +514,7 @@ static int mdb_entry_encode(Operation *op, MDB_txn *txn, Entry *e, MDB_val *data ; /* empty */ rc = mdb_entry_partsize( mdb, txn, e, &eh ); + if (rc) return rc; data->mv_size = eh.bv.bv_len; data->mv_data = op->o_tmpalloc(data->mv_size, op->o_tmpmemctx); -- 2.39.5