struct berval ptr, pdn;
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_ARGS, "bdb_dn2id_add( \"%s\", 0x%08lx )\n",
- e->e_ndn, (long) e->e_id ));
+ LDAP_LOG ( INDEX, ARGS, "bdb_dn2id_add( \"%s\", 0x%08lx )\n",
+ e->e_ndn, (long) e->e_id, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "=> bdb_dn2id_add( \"%s\", 0x%08lx )\n",
e->e_ndn, (long) e->e_id, 0 );
rc = db->put( db, txn, &key, &data, DB_NOOVERWRITE );
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_ERR,
- "bdb_dn2id_add: put failed: %s %d\n",
- db_strerror(rc), rc ));
+ LDAP_LOG ( INDEX, ERR, "bdb_dn2id_add: put failed: %s %d\n",
+ db_strerror(rc), rc, 0 );
#else
Debug( LDAP_DEBUG_ANY, "=> bdb_dn2id_add: put failed: %s %d\n",
db_strerror(rc), rc, 0 );
rc = bdb_idl_insert_key( be, db, txn, &key, e->e_id );
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_ERR,
- "=> bdb_dn2id_add: subtree (%s) insert failed: %d\n",
- ptr.bv_val, rc ));
+ LDAP_LOG ( INDEX, ERR,
+ "=> bdb_dn2id_add: subtree (%s) insert failed: %d\n",
+ ptr.bv_val, rc, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"=> bdb_dn2id_add: subtree (%s) insert failed: %d\n",
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_ERR,
+ LDAP_LOG ( INDEX, ERR,
"=> bdb_dn2id_add: parent (%s) insert failed: %d\n",
- ptr.bv_val, rc ));
+ ptr.bv_val, rc, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"=> bdb_dn2id_add: parent (%s) insert failed: %d\n",
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_ERR,
+ LDAP_LOG ( INDEX, ERR,
"=> bdb_dn2id_add: subtree (%s) insert failed: %d\n",
- ptr.bv_val, rc ));
+ ptr.bv_val, rc, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"=> bdb_dn2id_add: subtree (%s) insert failed: %d\n",
done:
ch_free( buf );
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_RESULTS,
- "<= bdb_dn2id_add: %d\n", rc ));
+ LDAP_LOG ( INDEX, RESULTS, "<= bdb_dn2id_add: %d\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "<= bdb_dn2id_add: %d\n", rc, 0, 0 );
#endif
struct berval pdn, ptr;
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_ARGS,
- "=> bdb_dn2id_delete ( \"%s\", 0x08lx )\n",
- e->e_ndn, e->e_id ));
+ LDAP_LOG ( INDEX, ARGS,
+ "=> bdb_dn2id_delete ( \"%s\", 0x%08lx )\n", e->e_ndn, e->e_id, 0);
#else
Debug( LDAP_DEBUG_TRACE, "=> bdb_dn2id_delete( \"%s\", 0x%08lx )\n",
e->e_ndn, e->e_id, 0 );
rc = db->del( db, txn, &key, 0 );
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_ERR,
+ LDAP_LOG ( INDEX, ERR,
"=> bdb_dn2id_delete: delete failed: %s %d\n",
- db_strerror(rc), rc ));
+ db_strerror(rc), rc, 0 );
#else
Debug( LDAP_DEBUG_ANY, "=> bdb_dn2id_delete: delete failed: %s %d\n",
db_strerror(rc), rc, 0 );
rc = db->del( db, txn, &key, 0 );
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_ERR,
- "=> bdb_dn2id_delete: subtree (%s) delete failed: %d\n",
- ptr.bv_val, rc ));
+ LDAP_LOG ( INDEX, ERR,
+ "=> bdb_dn2id_delete: subtree (%s) delete failed: %d\n",
+ ptr.bv_val, rc, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"=> bdb_dn2id_delete: subtree (%s) delete failed: %d\n",
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_ERR,
+ LDAP_LOG ( INDEX, ERR,
"=> bdb_dn2id_delete: parent (%s) delete failed: %d\n",
- ptr.bv_val, rc ));
+ ptr.bv_val, rc, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"=> bdb_dn2id_delete: parent (%s) delete failed: %d\n",
rc = bdb_idl_delete_key( be, db, txn, &key, e->e_id );
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_ERR,
+ LDAP_LOG ( INDEX, ERR,
"=> bdb_dn2id_delete: subtree (%s) delete failed: %d\n",
- ptr.bv_val, rc ));
+ ptr.bv_val, rc, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"=> bdb_dn2id_delete: subtree (%s) delete failed: %d\n",
done:
ch_free( buf );
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_RESULTS, "<= bdb_dn2id_delete %d\n", rc ));
+ LDAP_LOG ( INDEX, RESULTS, "<= bdb_dn2id_delete %d\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "<= bdb_dn2id_delete %d\n", rc, 0, 0 );
#endif
BackendDB *be,
DB_TXN *txn,
struct berval *dn,
- ID *id )
+ ID *id,
+ int flags )
{
int rc;
DBT key, data;
DB *db = bdb->bi_dn2id->bdi_db;
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_ARGS, "=> bdb_dn2id( \"%s\" )\n",
- dn->bv_val ));
+ LDAP_LOG ( INDEX, ARGS, "=> bdb_dn2id( \"%s\" )\n", dn->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "=> bdb_dn2id( \"%s\" )\n", dn->bv_val, 0, 0 );
#endif
data.flags = DB_DBT_USERMEM;
/* fetch it */
- rc = db->get( db, txn, &key, &data, bdb->bi_db_opflags );
+ rc = db->get( db, txn, &key, &data, bdb->bi_db_opflags | flags);
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_ERR,
- "<= bdb_dn2id: get failed %s (%d)\n",
- db_strerror(rc), rc ));
+ LDAP_LOG ( INDEX, ERR, "<= bdb_dn2id: get failed %s (%d)\n",
+ db_strerror(rc), rc, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "<= bdb_dn2id: get failed: %s (%d)\n",
db_strerror( rc ), rc, 0 );
#endif
} else {
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_RESULTS,
- "<= bdb_dn2id: got id=0x%08lx\n", *id ));
+ LDAP_LOG ( INDEX, RESULTS,
+ "<= bdb_dn2id: got id=0x%08lx\n", *id, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "<= bdb_dn2id: got id=0x%08lx\n",
*id, 0, 0 );
DB_TXN *txn,
struct berval *in,
ID *id,
- ID *id2 )
+ ID *id2,
+ int flags )
{
int rc;
DBT key, data;
ID cached_id;
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_ARGS,
- "=> bdb_dn2id_matched( \"%s\" )\n", in->bv_val ));
+ LDAP_LOG ( INDEX, ARGS,
+ "=> bdb_dn2id_matched( \"%s\" )\n", in->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "=> bdb_dn2id_matched( \"%s\" )\n", in->bv_val, 0, 0 );
#endif
break;
} else {
/* fetch it */
- rc = db->get(db, txn, &key, &data, bdb->bi_db_opflags );
+ rc = db->get(db, txn, &key, &data, bdb->bi_db_opflags | flags );
}
if( rc == DB_NOTFOUND ) {
dnParent( &dn, &pdn );
} else {
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_DETAIL1,
- "<= bdb_dn2id_matched: no match\n" ));
+ LDAP_LOG ( INDEX, DETAIL1,
+ "<= bdb_dn2id_matched: no match\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<= bdb_dn2id_matched: no match\n",
} else if ( rc == 0 ) {
if( data.size != sizeof( ID ) ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG ( INDEX, DETAIL1,
"<= bdb_dn2id_matched: get size mismatch:"
"expected %ld, got %ld\n",
- (long) sizeof(ID), (long) data.size ));
+ (long) sizeof(ID), (long) data.size, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"<= bdb_dn2id_matched: get size mismatch: "
}
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG ( INDEX, DETAIL1,
"<= bdb_dn2id_matched: id=0x%08lx: %s %s\n",
- (long) *id, *id2 == 0 ? "entry" : "matched", dn.bv_val ));
+ (long) *id, *id2 == 0 ? "entry" : "matched", dn.bv_val );
#else
Debug( LDAP_DEBUG_TRACE,
"<= bdb_dn2id_matched: id=0x%08lx: %s %s\n",
} else {
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_ERR,
+ LDAP_LOG ( INDEX, ERR,
"<= bdb_dn2id_matched: get failed: %s (%d)\n",
- db_strerror(rc), rc ));
+ db_strerror(rc), rc, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"<= bdb_dn2id_matched: get failed: %s (%d)\n",
bdb_dn2id_children(
BackendDB *be,
DB_TXN *txn,
- struct berval *dn )
+ struct berval *dn,
+ int flags )
{
int rc;
DBT key, data;
ID id;
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_ARGS,
- "=> bdb_dn2id_children( %s )\n", dn->bv_val ));
+ LDAP_LOG ( INDEX, ARGS,
+ "=> bdb_dn2id_children( %s )\n", dn->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "=> bdb_dn2id_children( %s )\n",
dn->bv_val, 0, 0 );
data.doff = 0;
data.dlen = sizeof(id);
- rc = db->get( db, txn, &key, &data, bdb->bi_db_opflags );
+ rc = db->get( db, txn, &key, &data, bdb->bi_db_opflags | flags );
free( key.data );
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG ( INDEX, DETAIL1,
"<= bdb_dn2id_children( %s ): %schildren (%d)\n",
dn->bv_val, rc == 0 ? "" : ( rc == DB_NOTFOUND ? "no " :
- db_strerror(rc)), rc ));
+ db_strerror(rc)), rc );
#else
Debug( LDAP_DEBUG_TRACE, "<= bdb_dn2id_children( %s ): %schildren (%d)\n",
dn->bv_val,
DB *db = bdb->bi_dn2id->bdi_db;
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_ARGS,
- "=> bdb_dn2ididl( \"%s\" )\n", dn->bv_val ));
+ LDAP_LOG ( INDEX, ARGS,
+ "=> bdb_dn2ididl( \"%s\" )\n", dn->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "=> bdb_dn2idl( \"%s\" )\n", dn->bv_val, 0, 0 );
#endif
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_ERR,
- "<= bdb_dn2ididl: get failed: %s (%d)\n",
- db_strerror(rc), rc ));
+ LDAP_LOG ( INDEX, ERR,
+ "<= bdb_dn2ididl: get failed: %s (%d)\n", db_strerror(rc), rc, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<= bdb_dn2idl: get failed: %s (%d)\n",
} else {
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_RESULTS,
+ LDAP_LOG ( INDEX, RESULTS,
"<= bdb_dn2ididl: id=%ld first=%ld last=%ld\n",
(long) ids[0], (long) BDB_IDL_FIRST( ids ),
- (long) BDB_IDL_LAST( ids ) ));
+ (long) BDB_IDL_LAST( ids ) );
#else
Debug( LDAP_DEBUG_TRACE,
"<= bdb_dn2idl: id=%ld first=%ld last=%ld\n",
* Note that this code always uses be_suffix[0], so defining
* multiple suffixes for a single backend won't work!
*/
- rdns = ldap_explode_dn(be->be_nsuffix[0]->bv_val, 0);
+ rdns = ldap_explode_dn(be->be_nsuffix[0].bv_val, 0);
for (i=0; rdns[i]; i++);
bdb->bi_nrdns = i;
charray_free(rdns);
ldap_pvt_thread_rdwr_rlock(&bdb->bi_tree_rdwr);
o = bdb_find_id_node(id, bdb->bi_tree);
- rlen = be->be_suffix[0]->bv_len + 1;
- nrlen = be->be_nsuffix[0]->bv_len + 1;
+ rlen = be->be_suffix[0].bv_len + 1;
+ nrlen = be->be_nsuffix[0].bv_len + 1;
for (n = o; n && n->i_parent; n=n->i_parent) {
rlen += n->i_rdn->rdn.bv_len + 1;
nrlen += n->i_rdn->nrdn.bv_len + 1;
ptr = e->e_name.bv_val;
nptr = e->e_nname.bv_val;
for (n = o; n && n->i_parent; n=n->i_parent) {
- ptr = slap_strcopy(ptr, n->i_rdn->rdn.bv_val);
+ ptr = lutil_strcopy(ptr, n->i_rdn->rdn.bv_val);
*ptr++ = ',';
- nptr = slap_strcopy(nptr, n->i_rdn->nrdn.bv_val);
+ nptr = lutil_strcopy(nptr, n->i_rdn->nrdn.bv_val);
*nptr++ = ',';
}
ldap_pvt_thread_rdwr_runlock(&bdb->bi_tree_rdwr);
- strcpy(ptr, be->be_suffix[0]->bv_val);
- strcpy(nptr, be->be_nsuffix[0]->bv_val);
+ strcpy(ptr, be->be_suffix[0].bv_val);
+ strcpy(nptr, be->be_nsuffix[0].bv_val);
return 0;
}