]> git.sur5r.net Git - openldap/commitdiff
Misc code cleanup
authorKurt Zeilenga <kurt@openldap.org>
Tue, 27 Nov 2001 03:41:03 +0000 (03:41 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Tue, 27 Nov 2001 03:41:03 +0000 (03:41 +0000)
19 files changed:
servers/slapd/back-bdb/add.c
servers/slapd/back-bdb/attr.c
servers/slapd/back-bdb/attribute.c
servers/slapd/back-bdb/bind.c
servers/slapd/back-bdb/compare.c
servers/slapd/back-bdb/dbcache.c
servers/slapd/back-bdb/delete.c
servers/slapd/back-bdb/error.c
servers/slapd/back-bdb/group.c
servers/slapd/back-bdb/id2entry.c
servers/slapd/back-bdb/index.c
servers/slapd/back-bdb/init.c
servers/slapd/back-bdb/key.c
servers/slapd/back-bdb/modify.c
servers/slapd/back-bdb/modrdn.c
servers/slapd/back-bdb/nextid.c
servers/slapd/back-bdb/passwd.c
servers/slapd/back-bdb/search.c
servers/slapd/back-bdb/tools.c

index 5ac264a773b21474a9b9ed0a904e0b7f3afc6c57..d562196879f972da77eab3e014ebdcba299bb616 100644 (file)
@@ -69,17 +69,17 @@ retry:      rc = txn_abort( ltid );
        }
 
        /* begin transaction */
-       if (bdb->bi_txn) {
-           rc = txn_begin( bdb->bi_dbenv, NULL, &ltid, 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, &ltid, 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;
@@ -275,8 +275,9 @@ retry:      rc = txn_abort( ltid );
                goto return_results;
        }
 
-       if( bdb->bi_txn )
+       if( bdb->bi_txn ) {
                rc = txn_commit( ltid, 0 );
+       }
        ltid = NULL;
        op->o_private = NULL;
 
index c4d9ef7831aec3d152ef6e7e452a3a1bea0c3b24..f8ff4a59cc115f71f5a6cc0f751f2ed3249ecfcf 100644 (file)
@@ -24,7 +24,7 @@ typedef struct bdb_attrinfo {
 static int
 ainfo_type_cmp(
        AttributeDescription *desc,
-    AttrInfo   *a
+       AttrInfo        *a
 )
 {
        return desc - a->ai_desc;
@@ -32,8 +32,8 @@ ainfo_type_cmp(
 
 static int
 ainfo_cmp(
-    AttrInfo   *a,
-    AttrInfo   *b
+       AttrInfo        *a,
+       AttrInfo        *b
 )
 {
        return a->ai_desc - b->ai_desc;
@@ -41,25 +41,25 @@ ainfo_cmp(
 
 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;
@@ -108,7 +108,7 @@ bdb_attr_index_config(
                }
        }
 
-    if( !mask ) {
+       if( !mask ) {
                fprintf( stderr, "%s: line %d: "
                        "no indexes selected\n",
                        fname, lineno );
@@ -182,8 +182,8 @@ bdb_attr_index_config(
 
 #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 ); 
@@ -199,7 +199,7 @@ bdb_attr_index_config(
                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;
                }
index dd5e6ecc8add657dc5947e13f66d0fa8f9c6318d..c98279871ee1fafc23761c9dbbdaae6362e62cda 100644 (file)
@@ -25,26 +25,26 @@ bdb_attribute(
        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",
@@ -63,8 +63,8 @@ bdb_attribute(
                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",
@@ -85,8 +85,8 @@ bdb_attribute(
                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",
@@ -97,21 +97,19 @@ bdb_attribute(
                
 #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 );
@@ -123,7 +121,7 @@ bdb_attribute(
        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 );
@@ -143,7 +141,7 @@ bdb_attribute(
        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",
@@ -197,8 +195,8 @@ return_results:
 
 #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",
index a85fb468ba5cedbe4c05a69fee3e08a5319278cc..f3dd16e15d37ffefbc018979e8642301fe2f5e2d 100644 (file)
@@ -201,7 +201,7 @@ bdb_bind(
 
                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;
index 42164ac577c8525334fc7e044280e9b2043715e7..ef32a591c9a50a00866b94fb6fa02872a58d67db 100644 (file)
@@ -102,8 +102,8 @@ bdb_compare(
                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;
index f45b84e73e583946ef431e3eb8af56453063703b..db63bcd705d900719eae832fb676a544a198f6ec 100644 (file)
@@ -20,8 +20,8 @@
 
 int
 bdb_db_cache(
-    Backend    *be,
-    const char *name,
+       Backend *be,
+       const char *name,
        DB **dbout )
 {
        int i;
index 315847d0f90c33a2017a55583788e02e5d935c9f..7cd603ef3595da7a393835b1f2afc9efd9a9aab8 100644 (file)
@@ -48,18 +48,18 @@ retry:      /* transaction retry */
                }
        }
 
-       if (bdb->bi_txn) {
-           /* begin transaction */
-           rc = txn_begin( bdb->bi_dbenv, NULL, &ltid, 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, &ltid, 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;
@@ -283,8 +283,9 @@ retry:      /* transaction retry */
                goto return_results;
        }
 
-       if (bdb->bi_txn)
+       if( bdb->bi_txn ) {
                rc = txn_commit( ltid, 0 );
+       }
        ltid = NULL;
        op->o_private = NULL;
 
index 00f528c97d20fb09c4e5608a9ab3127b20e64341..76ca23a8976d404486e9323a19d51df6d4c66096 100644 (file)
@@ -1,4 +1,4 @@
-/* error.c - BDB errcall routine  */
+/* error.c - BDB errcall routine */
 /* $OpenLDAP$ */
 /*
  * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
index 761bc0df9339d42cdab8ac33117a27dbe50e292a..bb102b1fac4c79f84a34c8fa77dafc73ab8efa62 100644 (file)
@@ -33,10 +33,10 @@ bdb_group(
        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;
@@ -51,8 +51,8 @@ bdb_group(
 
 #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",
@@ -75,7 +75,7 @@ bdb_group(
                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",
@@ -90,8 +90,8 @@ bdb_group(
                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",
@@ -101,26 +101,24 @@ bdb_group(
                }
 #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 );
@@ -131,7 +129,7 @@ bdb_group(
        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 );
@@ -142,8 +140,8 @@ bdb_group(
        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", 
@@ -155,7 +153,7 @@ bdb_group(
        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",
@@ -166,8 +164,8 @@ bdb_group(
 
 #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",
@@ -175,13 +173,13 @@ bdb_group(
 #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", 
@@ -192,8 +190,8 @@ bdb_group(
 
 #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", 
@@ -210,7 +208,7 @@ return_results:
 
 #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
index 2dfc2cb230741eec2e1e3769616cd799fe3bf05e..4686dadf2df1b2ab009d95c0c4b3cbb558c33946 100644 (file)
@@ -141,9 +141,11 @@ int bdb_entry_return(
         * 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);
 
index 25f4c98f7b246c781e8358caac6db4be2e201c6c..78a65376ed811452bd3cab7761ef08301af0347d 100644 (file)
@@ -385,7 +385,7 @@ bdb_index_entry(
                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",
index 8d1e8d2a9801e8ede038e55fe5b6a3812b3b400c..6511221c19431f1af3418969749cb53dd40dedf6 100644 (file)
@@ -121,9 +121,11 @@ bdb_db_open( BackendDB *be )
        }
 
        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);
@@ -190,8 +192,8 @@ bdb_db_open( BackendDB *be )
                        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;
                }
        }
@@ -264,14 +266,14 @@ bdb_db_close( BackendDB *be )
        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-- ) {
index 7ca382532ebabcea82af6df0e14306395dfb8045..6156c126fa9c6adfd137277574cb8e724b669cfd 100644 (file)
 /* read a key */
 int
 bdb_key_read(
-    Backend    *be,
+       Backend *be,
        DB *db,
        DB_TXN *txn,
-    struct berval *k,
+       struct berval *k,
        ID *ids
 )
 {
@@ -56,7 +56,7 @@ bdb_key_read(
                        "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
        }
 
@@ -66,12 +66,12 @@ bdb_key_read(
 /* 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;
@@ -90,12 +90,12 @@ bdb_key_change(
        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
index 10931b6a29fe066427ad1b6b08486ecb0982db8a..d1612cd6a7c2142b5e18ac38b50d1d9fcabf5193 100644 (file)
@@ -187,18 +187,18 @@ retry:    /* transaction retry */
                }
        }
 
-       if (bdb->bi_txn) {
-           /* begin transaction */
-           rc = txn_begin( bdb->bi_dbenv, NULL, &ltid, 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, &ltid, 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;
@@ -302,8 +302,9 @@ retry:      /* transaction retry */
                goto return_results;
        }
 
-       if (bdb->bi_txn)
+       if( bdb->bi_txn ) {
                rc = txn_commit( ltid, 0 );
+       }
        ltid = NULL;
        op->o_private = NULL;
 
@@ -325,7 +326,7 @@ return_results:
        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 );
index b49df286fe2802208f67275d8ec36c49cd51e584..260b917d99c3648d0117ea300bab90aa0fdf499b 100644 (file)
@@ -82,18 +82,18 @@ retry:      /* transaction retry */
        }
 
 
-       if (bdb->bi_txn) {
-           /* begin transaction */
-           rc = txn_begin( bdb->bi_dbenv, NULL, &ltid, 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, &ltid, 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;
@@ -211,7 +211,7 @@ retry:      /* transaction retry */
 
        } 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 ) ) {
 
@@ -327,7 +327,7 @@ retry:      /* transaction retry */
 
                } else {
                        if ( isroot == -1 ) {
-                               isroot =  be_isroot( be, op->o_ndn );
+                               isroot = be_isroot( be, op->o_ndn );
                        }
                        
                        np_dn = ch_strdup( "" );
@@ -608,8 +608,9 @@ retry:      /* transaction retry */
                goto return_results;
        }
 
-       if (bdb->bi_txn)
+       if( bdb->bi_txn ) {
                rc = txn_commit( ltid, 0 );
+       }
        ltid = NULL;
        op->o_private = NULL;
 
@@ -631,7 +632,7 @@ return_results:
        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 );
index f0b550cfc6fec3daf0daa1174992b4b4345f7a83..f7a3e6dfbae49587abe6d10f4458f6f140c4addc 100644 (file)
@@ -48,14 +48,14 @@ retry:      if( tid != NULL ) {
                }
        }
 
-       if (bdb->bi_txn) {
-           rc = txn_begin( bdb->bi_dbenv, tid, &ltid, 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, &ltid, 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 */
@@ -107,8 +107,7 @@ retry:      if( tid != NULL ) {
 
                bdb->bi_lastid = id;
 
-               if (bdb->bi_txn)
-               {
+               if (bdb->bi_txn) {
                        rc = txn_commit( ltid, 0 );
                        ltid = NULL;
                }
index 4aa820920afad597ab32ff1e52b7f48d4698288b..48be3bbf4e205b1495a83df31e360be794a4f520 100644 (file)
@@ -97,18 +97,18 @@ retry:      /* transaction retry */
                }
        }
 
-       if (bdb->bi_txn) {
-           /* begin transaction */
-           rc = txn_begin( bdb->bi_dbenv, NULL, &ltid, 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, &ltid, 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;
@@ -198,7 +198,8 @@ retry:      /* transaction retry */
                *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;
        }
index c034dc2115b3610819e166478ac8498833d35b42..1251cefaab7177ce782d90661cf2e629eddac544 100644 (file)
@@ -127,7 +127,7 @@ bdb_search(
                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,
@@ -170,7 +170,7 @@ bdb_search(
        /* 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 ) {
@@ -533,28 +533,26 @@ static int search_candidates(
         * 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 = &af;
-           }
+               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 = &af;
+               }
 #endif
        }
 
index 32fe32cd82d2a60af6ec6a86351cf325d4352705..892db3ee73d859b8996cc3a3ae54f39b5ed5eb33 100644 (file)
@@ -119,14 +119,14 @@ ID bdb_tool_entry_put(
        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 );
@@ -165,22 +165,22 @@ ID bdb_tool_entry_put(
 
 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;
@@ -208,13 +208,13 @@ int bdb_tool_entry_reindex(
        }
 
        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;
+               }
        }
        
        /*
@@ -229,23 +229,23 @@ int bdb_tool_entry_reindex(
 
        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: