}
/* begin transaction */
- if (bdb->bi_txn) {
- rc = txn_begin( bdb->bi_dbenv, NULL, <id, 0 );
- text = NULL;
- if( rc != 0 ) {
- Debug( LDAP_DEBUG_TRACE,
- "bdb_add: txn_begin failed: %s (%d)\n",
- db_strerror(rc), rc, 0 );
- rc = LDAP_OTHER;
- text = "internal error";
- goto return_results;
- }
+ if( bdb->bi_txn ) {
+ rc = txn_begin( bdb->bi_dbenv, NULL, <id, 0 );
+ text = NULL;
+ if( rc != 0 ) {
+ Debug( LDAP_DEBUG_TRACE,
+ "bdb_add: txn_begin failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
+ rc = LDAP_OTHER;
+ text = "internal error";
+ goto return_results;
+ }
}
opinfo.boi_bdb = be;
goto return_results;
}
- if( bdb->bi_txn )
+ if( bdb->bi_txn ) {
rc = txn_commit( ltid, 0 );
+ }
ltid = NULL;
op->o_private = NULL;
static int
ainfo_type_cmp(
AttributeDescription *desc,
- AttrInfo *a
+ AttrInfo *a
)
{
return desc - a->ai_desc;
static int
ainfo_cmp(
- AttrInfo *a,
- AttrInfo *b
+ AttrInfo *a,
+ AttrInfo *b
)
{
return a->ai_desc - b->ai_desc;
void
bdb_attr_mask(
- struct bdb_info *bdb,
- AttributeDescription *desc,
- slap_mask_t *indexmask )
+ struct bdb_info *bdb,
+ AttributeDescription *desc,
+ slap_mask_t *indexmask )
{
AttrInfo *a;
a = (AttrInfo *) avl_find( bdb->bi_attrs, desc,
- (AVL_CMP) ainfo_type_cmp );
+ (AVL_CMP) ainfo_type_cmp );
*indexmask = a != NULL ? a->ai_indexmask : 0;
}
int
bdb_attr_index_config(
- struct bdb_info *bdb,
- const char *fname,
- int lineno,
- int argc,
- char **argv )
+ struct bdb_info *bdb,
+ const char *fname,
+ int lineno,
+ int argc,
+ char **argv )
{
int rc;
int i;
}
}
- if( !mask ) {
+ if( !mask ) {
fprintf( stderr, "%s: line %d: "
"no indexes selected\n",
fname, lineno );
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "attr_index_config: index %s 0x%04x\n",
- ad->ad_cname.bv_val, mask ));
+ "attr_index_config: index %s 0x%04x\n",
+ ad->ad_cname.bv_val, mask ));
#else
Debug( LDAP_DEBUG_CONFIG, "index %s 0x%04x\n",
ad->ad_cname.bv_val, mask, 0 );
if( rc ) {
fprintf( stderr, "%s: line %d: duplicate index definition "
"for attr \"%s\" (ignored)\n",
- fname, lineno, attrs[i] );
+ fname, lineno, attrs[i] );
return LDAP_PARAM_ERROR;
}
Backend *be,
Connection *conn,
Operation *op,
- Entry *target,
- const char *e_ndn,
+ Entry *target,
+ const char *e_ndn,
AttributeDescription *entry_at,
struct berval ***vals )
{
- struct bdbinfo *li = (struct bdbinfo *) be->be_private;
- Entry *e;
- int i, j, rc;
- Attribute *attr;
+ struct bdbinfo *li = (struct bdbinfo *) be->be_private;
+ Entry *e;
+ int i, j, rc;
+ Attribute *attr;
struct berval **v;
const char *entry_at_name = entry_at->ad_cname.bv_val;
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_ARGS,
- "bdb_attribute: gr dn: \"%s\"\n", e_ndn ));
+ "bdb_attribute: gr dn: \"%s\"\n", e_ndn ));
LDAP_LOG(( "backend", LDAP_LEVEL_ARGS,
- "bdb_attribute: at: \"%s\"\n", entry_at_name));
+ "bdb_attribute: at: \"%s\"\n", entry_at_name));
LDAP_LOG(( "backend", LDAP_LEVEL_ARGS,
- "bdb_attribute: tr dn: \"%s\"\n",
- target ? target->e_ndn : "" ));
+ "bdb_attribute: tr dn: \"%s\"\n",
+ target ? target->e_ndn : "" ));
#else
Debug( LDAP_DEBUG_ARGS,
"=> bdb_attribute: gr dn: \"%s\"\n",
e = target;
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "bdb_attribute: target is LOCKED (%s)\n",
- e_ndn ));
+ "bdb_attribute: target is LOCKED (%s)\n",
+ e_ndn ));
#else
Debug( LDAP_DEBUG_ARGS,
"=> bdb_attribute: target is entry: \"%s\"\n",
if (e == NULL) {
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "bdb_attribute: cannot find entry (%s)\n",
- e_ndn ));
+ "bdb_attribute: cannot find entry (%s)\n",
+ e_ndn ));
#else
Debug( LDAP_DEBUG_ACL,
"=> bdb_attribute: cannot find entry: \"%s\"\n",
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "bdb_attribute: found entry (%s)\n", e_ndn ));
+ "bdb_attribute: found entry (%s)\n", e_ndn ));
#else
Debug( LDAP_DEBUG_ACL,
"=> bdb_attribute: found entry: \"%s\"\n",
e_ndn, 0, 0 );
#endif
-
- }
+ }
/* find attribute values */
-
if( is_entry_alias( e ) ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "bdb_attribute: entry (%s) is an alias\n", e->e_dn ));
+ "bdb_attribute: entry (%s) is an alias\n", e->e_dn ));
#else
Debug( LDAP_DEBUG_ACL,
"<= bdb_attribute: entry is an alias\n", 0, 0, 0 );
if( is_entry_referral( e ) ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "bdb_attribute: entry (%s) is a referral.\n", e->e_dn ));
+ "bdb_attribute: entry (%s) is a referral.\n", e->e_dn ));
#else
Debug( LDAP_DEBUG_ACL,
"<= bdb_attribute: entry is a referral\n", 0, 0, 0 );
if ((attr = attr_find(e->e_attrs, entry_at)) == NULL) {
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "bdb_attribute: failed to find %s.\n", entry_at_name ));
+ "bdb_attribute: failed to find %s.\n", entry_at_name ));
#else
Debug( LDAP_DEBUG_ACL,
"<= bdb_attribute: failed to find %s\n",
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
- "bdb_attribute: rc=%d nvals=%d.\n",
- rc, j ));
+ "bdb_attribute: rc=%d nvals=%d.\n",
+ rc, j ));
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_attribute: rc=%d nvals=%d\n",
if ( (a = attr_find( e->e_attrs, krbattr )) == NULL ) {
/*
- * no krbname values present: check against DN
+ * no krbname values present: check against DN
*/
if ( strcasecmp( dn, krbname ) == 0 ) {
rc = 0;
rc = LDAP_COMPARE_FALSE;
if ( value_find_ex( ava->aa_desc,
- SLAP_MR_VALUE_IS_IN_MR_SYNTAX,
- a->a_vals, ava->aa_value ) == 0 )
+ SLAP_MR_VALUE_IS_IN_MR_SYNTAX,
+ a->a_vals, ava->aa_value ) == 0 )
{
rc = LDAP_COMPARE_TRUE;
break;
int
bdb_db_cache(
- Backend *be,
- const char *name,
+ Backend *be,
+ const char *name,
DB **dbout )
{
int i;
}
}
- if (bdb->bi_txn) {
- /* begin transaction */
- rc = txn_begin( bdb->bi_dbenv, NULL, <id, 0 );
- text = NULL;
- if( rc != 0 ) {
- Debug( LDAP_DEBUG_TRACE,
- "bdb_delete: txn_begin failed: %s (%d)\n",
- db_strerror(rc), rc, 0 );
- rc = LDAP_OTHER;
- text = "internal error";
- goto return_results;
- }
+ if( bdb->bi_txn ) {
+ /* begin transaction */
+ rc = txn_begin( bdb->bi_dbenv, NULL, <id, 0 );
+ text = NULL;
+ if( rc != 0 ) {
+ Debug( LDAP_DEBUG_TRACE,
+ "bdb_delete: txn_begin failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
+ rc = LDAP_OTHER;
+ text = "internal error";
+ goto return_results;
+ }
}
opinfo.boi_bdb = be;
goto return_results;
}
- if (bdb->bi_txn)
+ if( bdb->bi_txn ) {
rc = txn_commit( ltid, 0 );
+ }
ltid = NULL;
op->o_private = NULL;
-/* error.c - BDB errcall routine */
+/* error.c - BDB errcall routine */
/* $OpenLDAP$ */
/*
* Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
AttributeDescription *group_at
)
{
- struct bdbinfo *li = (struct bdbinfo *) be->be_private;
- Entry *e;
- int rc = 1;
- Attribute *attr;
+ struct bdbinfo *li = (struct bdbinfo *) be->be_private;
+ Entry *e;
+ int rc = 1;
+ Attribute *attr;
struct berval bv;
AttributeDescription *ad_objectClass = slap_schema.si_ad_objectClass;
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
- "bdb_group: check (%s) member of (%s), oc %s\n",
- op_ndn, gr_ndn, group_oc_name ));
+ "bdb_group: check (%s) member of (%s), oc %s\n",
+ op_ndn, gr_ndn, group_oc_name ));
#else
Debug( LDAP_DEBUG_ARGS,
"=> bdb_group: gr dn: \"%s\"\n",
e = target;
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "bdb_group: target is group (%s)\n", gr_ndn ));
+ "bdb_group: target is group (%s)\n", gr_ndn ));
#else
Debug( LDAP_DEBUG_ARGS,
"=> bdb_group: target is group: \"%s\"\n",
if (e == NULL) {
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "bdb_group: cannot find group (%s)\n",
- gr_ndn ));
+ "bdb_group: cannot find group (%s)\n",
+ gr_ndn ));
#else
Debug( LDAP_DEBUG_ACL,
"=> bdb_group: cannot find group: \"%s\"\n",
}
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "bdb_group: found group (%s)\n", gr_ndn ));
+ "bdb_group: found group (%s)\n", gr_ndn ));
#else
Debug( LDAP_DEBUG_ACL,
"=> bdb_group: found group: \"%s\"\n",
gr_ndn, 0, 0 );
#endif
- }
+ }
/* find it's objectClass and member attribute values
* make sure this is a group entry
* finally test if we can find op_dn in the member attribute value list
*/
-
rc = 1;
-
-
+
if( is_entry_alias( e ) ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "bdb_group: group (%s) is an alias\n", gr_ndn ));
+ "bdb_group: group (%s) is an alias\n", gr_ndn ));
#else
Debug( LDAP_DEBUG_ACL,
"<= bdb_group: group is an alias\n", 0, 0, 0 );
if( is_entry_referral( e ) ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "bdb_group: group (%s) is a referral.\n", gr_ndn ));
+ "bdb_group: group (%s) is a referral.\n", gr_ndn ));
#else
Debug( LDAP_DEBUG_ACL,
"<= bdb_group: group is a referral\n", 0, 0, 0 );
if( !is_entry_objectclass( e, group_oc ) ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
- "bdb_group: failed to find %s in objectClass.\n",
- group_oc_name ));
+ "bdb_group: failed to find %s in objectClass.\n",
+ group_oc_name ));
#else
Debug( LDAP_DEBUG_ACL,
"<= bdb_group: failed to find %s in objectClass\n",
if ((attr = attr_find(e->e_attrs, group_at)) == NULL) {
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "bdb_group: failed to find %s\n", group_at_name ));
+ "bdb_group: failed to find %s\n", group_at_name ));
#else
Debug( LDAP_DEBUG_ACL,
"<= bdb_group: failed to find %s\n",
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
- "bdb_group: found objectClass %s and %s\n",
- group_oc_name, group_at_name ));
+ "bdb_group: found objectClass %s and %s\n",
+ group_oc_name, group_at_name ));
#else
Debug( LDAP_DEBUG_ACL,
"<= bdb_group: found objectClass %s and %s\n",
#endif
bv.bv_val = (char *) op_ndn;
- bv.bv_len = strlen( op_ndn );
+ bv.bv_len = strlen( op_ndn );
if( value_find( group_at, attr->a_vals, &bv ) != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "bdb_group: \"%s\" not in \"%s\": %s\n",
- op_ndn, gr_ndn, group_at_name ));
+ "bdb_group: \"%s\" not in \"%s\": %s\n",
+ op_ndn, gr_ndn, group_at_name ));
#else
Debug( LDAP_DEBUG_ACL,
"<= bdb_group: \"%s\" not in \"%s\": %s\n",
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "bdb_group: %s is in %s: %s\n",
- op_ndn, gr_ndn, group_at_name ));
+ "bdb_group: %s is in %s: %s\n",
+ op_ndn, gr_ndn, group_at_name ));
#else
Debug( LDAP_DEBUG_ACL,
"<= bdb_group: \"%s\" is in \"%s\": %s\n",
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
- "bdb_group: rc=%d\n", rc ));
+ "bdb_group: rc=%d\n", rc ));
#else
Debug( LDAP_DEBUG_TRACE, "bdb_group: rc=%d\n", rc, 0, 0 );
#endif
* an entry has been modified, in which case the attr list will
* have been alloc'd separately.
*/
- if ((void *)e->e_attrs < (void *)e ||
- (void *)e->e_attrs > e->e_private)
- attrs_free(e->e_attrs);
+ if( (void *) e->e_attrs < (void *) e
+ || (void *) e->e_attrs > e->e_private )
+ {
+ attrs_free(e->e_attrs);
+ }
ch_free(e);
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "index", LDAP_LEVEL_ENTRY,
- "index_entry: success\n" ));
+ "index_entry: success\n" ));
#else
Debug( LDAP_DEBUG_TRACE,
"<= index_entry_%s( %ld, \"%s\" ) success\n",
}
flags = DB_INIT_MPOOL | DB_THREAD | DB_CREATE;
- if( bdb->bi_txn )
+
+ if( bdb->bi_txn ) {
flags |= DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_TXN | DB_RECOVER;
- else {
+
+ } else {
flags |= DB_INIT_CDB;
bdb->bi_txn_cp = 0;
bdb->bi_dbenv->set_lk_detect(bdb->bi_dbenv, DB_LOCK_DEFAULT);
bdb->bi_dbenv_xflags, 1);
if( rc != 0 ) {
Debug( LDAP_DEBUG_ANY,
- "bdb_db_open: dbenv_set_flags failed: %s (%d)\n",
- db_strerror(rc), rc, 0 );
+ "bdb_db_open: dbenv_set_flags failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
return rc;
}
}
struct bdb_info *bdb = (struct bdb_info *) be->be_private;
/* force a checkpoint */
- if (bdb->bi_txn) {
- rc = txn_checkpoint( bdb->bi_dbenv, 0, 0, DB_FORCE );
- if( rc != 0 ) {
- Debug( LDAP_DEBUG_ANY,
- "bdb_db_destroy: txn_checkpoint failed: %s (%d)\n",
- db_strerror(rc), rc, 0 );
- return rc;
- }
+ if( bdb->bi_txn ) {
+ rc = txn_checkpoint( bdb->bi_dbenv, 0, 0, DB_FORCE );
+ if( rc != 0 ) {
+ Debug( LDAP_DEBUG_ANY,
+ "bdb_db_destroy: txn_checkpoint failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
+ return rc;
+ }
}
while( bdb->bi_ndatabases-- ) {
/* read a key */
int
bdb_key_read(
- Backend *be,
+ Backend *be,
DB *db,
DB_TXN *txn,
- struct berval *k,
+ struct berval *k,
ID *ids
)
{
"bdb_key_read: %ld candidates\n", (long) BDB_IDL_N(ids) ));
#else
Debug( LDAP_DEBUG_TRACE, "<= bdb_index_read %ld candidates\n",
- (long) BDB_IDL_N(ids), 0, 0 );
+ (long) BDB_IDL_N(ids), 0, 0 );
#endif
}
/* Add or remove stuff from index files */
int
bdb_key_change(
- Backend *be,
- DB *db,
+ Backend *be,
+ DB *db,
DB_TXN *txn,
- struct berval *k,
- ID id,
- int op
+ struct berval *k,
+ ID id,
+ int op
)
{
int rc;
bv2DBT(k,&key);
if (op == SLAP_INDEX_ADD_OP) {
- /* Add values */
- rc = bdb_idl_insert_key( be, db, txn, &key, id );
+ /* Add values */
+ rc = bdb_idl_insert_key( be, db, txn, &key, id );
} else {
- /* Delete values */
- rc = bdb_idl_delete_key( be, db, txn, &key, id );
+ /* Delete values */
+ rc = bdb_idl_delete_key( be, db, txn, &key, id );
}
#ifdef NEW_LOGGING
}
}
- if (bdb->bi_txn) {
- /* begin transaction */
- rc = txn_begin( bdb->bi_dbenv, NULL, <id, 0 );
- text = NULL;
- if( rc != 0 ) {
- Debug( LDAP_DEBUG_TRACE,
- "bdb_modify: txn_begin failed: %s (%d)\n",
- db_strerror(rc), rc, 0 );
- rc = LDAP_OTHER;
- text = "internal error";
- goto return_results;
- }
+ if( bdb->bi_txn ) {
+ /* begin transaction */
+ rc = txn_begin( bdb->bi_dbenv, NULL, <id, 0 );
+ text = NULL;
+ if( rc != 0 ) {
+ Debug( LDAP_DEBUG_TRACE,
+ "bdb_modify: txn_begin failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
+ rc = LDAP_OTHER;
+ text = "internal error";
+ goto return_results;
+ }
}
opinfo.boi_bdb = be;
goto return_results;
}
- if (bdb->bi_txn)
+ if( bdb->bi_txn ) {
rc = txn_commit( ltid, 0 );
+ }
ltid = NULL;
op->o_private = NULL;
send_ldap_result( conn, op, rc,
NULL, text, NULL, NULL );
- if(rc == LDAP_SUCCESS && bdb->bi_txn_cp ) {
+ if( rc == LDAP_SUCCESS && bdb->bi_txn_cp ) {
ldap_pvt_thread_yield();
txn_checkpoint( bdb->bi_dbenv,
bdb->bi_txn_cp_kbyte, bdb->bi_txn_cp_min, 0 );
}
- if (bdb->bi_txn) {
- /* begin transaction */
- rc = txn_begin( bdb->bi_dbenv, NULL, <id, 0 );
- text = NULL;
- if( rc != 0 ) {
- Debug( LDAP_DEBUG_TRACE,
- "bdb_delete: txn_begin failed: %s (%d)\n",
- db_strerror(rc), rc, 0 );
- rc = LDAP_OTHER;
- text = "internal error";
- goto return_results;
- }
+ if( bdb->bi_txn ) {
+ /* begin transaction */
+ rc = txn_begin( bdb->bi_dbenv, NULL, <id, 0 );
+ text = NULL;
+ if( rc != 0 ) {
+ Debug( LDAP_DEBUG_TRACE,
+ "bdb_delete: txn_begin failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
+ rc = LDAP_OTHER;
+ text = "internal error";
+ goto return_results;
+ }
}
opinfo.boi_bdb = be;
} else {
/* no parent, modrdn entry directly under root */
- isroot = be_isroot( be, op->o_ndn );
+ isroot = be_isroot( be, op->o_ndn );
if ( ! isroot ) {
if ( be_issuffix( be, "" ) || be_isupdate( be, op->o_ndn ) ) {
} else {
if ( isroot == -1 ) {
- isroot = be_isroot( be, op->o_ndn );
+ isroot = be_isroot( be, op->o_ndn );
}
np_dn = ch_strdup( "" );
goto return_results;
}
- if (bdb->bi_txn)
+ if( bdb->bi_txn ) {
rc = txn_commit( ltid, 0 );
+ }
ltid = NULL;
op->o_private = NULL;
send_ldap_result( conn, op, rc,
NULL, text, NULL, NULL );
- if(rc == LDAP_SUCCESS && bdb->bi_txn_cp ) {
+ if( rc == LDAP_SUCCESS && bdb->bi_txn_cp ) {
ldap_pvt_thread_yield();
txn_checkpoint( bdb->bi_dbenv,
bdb->bi_txn_cp_kbyte, bdb->bi_txn_cp_min, 0 );
}
}
- if (bdb->bi_txn) {
- rc = txn_begin( bdb->bi_dbenv, tid, <id, 0 );
- if( rc != 0 ) {
- Debug( LDAP_DEBUG_ANY,
- "=> bdb_next_id: txn_begin failed: %s (%d)\n",
- db_strerror(rc), rc, 0 );
- return rc;
- }
+ if( bdb->bi_txn ) {
+ rc = txn_begin( bdb->bi_dbenv, tid, <id, 0 );
+ if( rc != 0 ) {
+ Debug( LDAP_DEBUG_ANY,
+ "=> bdb_next_id: txn_begin failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
+ return rc;
+ }
}
/* get existing value for read/modify/write */
bdb->bi_lastid = id;
- if (bdb->bi_txn)
- {
+ if (bdb->bi_txn) {
rc = txn_commit( ltid, 0 );
ltid = NULL;
}
}
}
- if (bdb->bi_txn) {
- /* begin transaction */
- rc = txn_begin( bdb->bi_dbenv, NULL, <id, 0 );
- *text = NULL;
- if( rc != 0 ) {
- Debug( LDAP_DEBUG_TRACE,
- "bdb_exop_passwd: txn_begin failed: %s (%d)\n",
- db_strerror(rc), rc, 0 );
- rc = LDAP_OTHER;
- *text = "internal error";
- goto done;
- }
+ if( bdb->bi_txn ) {
+ /* begin transaction */
+ rc = txn_begin( bdb->bi_dbenv, NULL, <id, 0 );
+ *text = NULL;
+ if( rc != 0 ) {
+ Debug( LDAP_DEBUG_TRACE,
+ "bdb_exop_passwd: txn_begin failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
+ rc = LDAP_OTHER;
+ *text = "internal error";
+ goto done;
+ }
}
opinfo.boi_bdb = be;
*text = "entry update failed";
rc = LDAP_OTHER;
}
- if (bdb->bi_txn && rc == 0) {
+
+ if( bdb->bi_txn && rc == 0 ) {
rc = txn_commit( ltid, 0 );
ltid = NULL;
}
return rc;
}
- if (!manageDSAit && e != &slap_entry_root && is_entry_referral( e ) ) {
+ if (!manageDSAit && e != &slap_entry_root && is_entry_referral( e ) ) {
/* entry is a referral, don't allow add */
char *matched_dn = ch_strdup( e->e_dn );
struct berval **erefs = get_entry_referrals( be,
/* if no time limit requested, use soft limit (unless root!) */
if ( isroot ) {
if ( tlimit == 0 ) {
- tlimit = -1; /* allow root to set no limit */
+ tlimit = -1; /* allow root to set no limit */
}
if ( slimit == 0 ) {
* it just uses objectClass=*, these clauses are redundant.
*/
if (oc_filter(filter)) {
- if( !manageDSAit ) {
- /* match referrals */
- static struct berval bv_ref = { sizeof("REFERRAL")-1, "REFERRAL" };
- rf.f_choice = LDAP_FILTER_EQUALITY;
- rf.f_ava = &aa_ref;
- rf.f_av_desc = slap_schema.si_ad_objectClass;
- rf.f_av_value = &bv_ref;
- rf.f_next = xf.f_or;
- xf.f_or = &rf;
- }
+ if( !manageDSAit ) { /* match referrals */
+ static struct berval bv_ref = { sizeof("REFERRAL")-1, "REFERRAL" };
+ rf.f_choice = LDAP_FILTER_EQUALITY;
+ rf.f_ava = &aa_ref;
+ rf.f_av_desc = slap_schema.si_ad_objectClass;
+ rf.f_av_value = &bv_ref;
+ rf.f_next = xf.f_or;
+ xf.f_or = &rf;
+ }
#ifdef BDB_ALIASES
- if( deref & LDAP_DEREF_SEARCHING ) {
- /* match aliases */
- static struct berval bv_alias = { sizeof("ALIAS")-1, "ALIAS" };
- af.f_choice = LDAP_FILTER_EQUALITY;
- af.f_ava = &aa_alias;
- af.f_av_desc = slap_schema.si_ad_objectClass;
- af.f_av_value = &bv_alias;
- af.f_next = xf.f_or;
- xf.f_or = ⁡
- }
+ if( deref & LDAP_DEREF_SEARCHING ) { /* match aliases */
+ static struct berval bv_alias = { sizeof("ALIAS")-1, "ALIAS" };
+ af.f_choice = LDAP_FILTER_EQUALITY;
+ af.f_ava = &aa_alias;
+ af.f_av_desc = slap_schema.si_ad_objectClass;
+ af.f_av_value = &bv_alias;
+ af.f_next = xf.f_or;
+ xf.f_or = ⁡
+ }
#endif
}
Debug( LDAP_DEBUG_TRACE, "=> bdb_tool_entry_put( %ld, \"%s\" )\n",
(long) e->e_id, e->e_dn, 0 );
- if (bdb->bi_txn) {
- rc = txn_begin( bdb->bi_dbenv, NULL, &tid, 0 );
- if( rc != 0 ) {
- Debug( LDAP_DEBUG_ANY,
- "=> bdb_tool_entry_put: txn_begin failed: %s (%d)\n",
- db_strerror(rc), rc, 0 );
- return NOID;
- }
+ if( bdb->bi_txn ) {
+ rc = txn_begin( bdb->bi_dbenv, NULL, &tid, 0 );
+ if( rc != 0 ) {
+ Debug( LDAP_DEBUG_ANY,
+ "=> bdb_tool_entry_put: txn_begin failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
+ return NOID;
+ }
}
rc = bdb_next_id( be, tid, &e->e_id );
done:
if( bdb->bi_txn ) {
- if( rc == 0 ) {
- rc = txn_commit( tid, 0 );
- if( rc != 0 ) {
+ if( rc == 0 ) {
+ rc = txn_commit( tid, 0 );
+ if( rc != 0 ) {
+ Debug( LDAP_DEBUG_ANY,
+ "=> bdb_tool_entry_put: txn_commit failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
+ e->e_id = NOID;
+ }
+
+ } else {
+ txn_abort( tid );
Debug( LDAP_DEBUG_ANY,
- "=> bdb_tool_entry_put: txn_commit failed: %s (%d)\n",
+ "=> bdb_tool_entry_put: txn_aborted! %s (%d)\n",
db_strerror(rc), rc, 0 );
e->e_id = NOID;
}
-
- } else {
- txn_abort( tid );
- Debug( LDAP_DEBUG_ANY,
- "=> bdb_tool_entry_put: txn_aborted! %s (%d)\n",
- db_strerror(rc), rc, 0 );
- e->e_id = NOID;
- }
}
return e->e_id;
}
if( bi->bi_txn ) {
- rc = txn_begin( bi->bi_dbenv, NULL, &tid, 0 );
- if( rc != 0 ) {
- Debug( LDAP_DEBUG_ANY,
- "=> bdb_tool_entry_reindex: txn_begin failed: %s (%d)\n",
- db_strerror(rc), rc, 0 );
- goto done;
- }
+ rc = txn_begin( bi->bi_dbenv, NULL, &tid, 0 );
+ if( rc != 0 ) {
+ Debug( LDAP_DEBUG_ANY,
+ "=> bdb_tool_entry_reindex: txn_begin failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
+ goto done;
+ }
}
/*
rc = bdb_index_entry_add( be, tid, e, e->e_attrs );
- if (bi->bi_txn) {
- if( rc == 0 ) {
- rc = txn_commit( tid, 0 );
- if( rc != 0 ) {
+ if( bi->bi_txn ) {
+ if( rc == 0 ) {
+ rc = txn_commit( tid, 0 );
+ if( rc != 0 ) {
+ Debug( LDAP_DEBUG_ANY,
+ "=> bdb_tool_entry_reindex: txn_commit failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
+ e->e_id = NOID;
+ }
+
+ } else {
+ txn_abort( tid );
Debug( LDAP_DEBUG_ANY,
- "=> bdb_tool_entry_reindex: txn_commit failed: %s (%d)\n",
+ "=> bdb_tool_entry_reindex: txn_aborted! %s (%d)\n",
db_strerror(rc), rc, 0 );
e->e_id = NOID;
}
-
- } else {
- txn_abort( tid );
- Debug( LDAP_DEBUG_ANY,
- "=> bdb_tool_entry_reindex: txn_aborted! %s (%d)\n",
- db_strerror(rc), rc, 0 );
- e->e_id = NOID;
- }
}
done: