]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-bdb/config.c
Fix prev commit, cleanup fakeroot entry before freeing
[openldap] / servers / slapd / back-bdb / config.c
index 6445e5fca947186bbf55bf40078c6c6ca3598600..4d92f2f834361846eab0ccbe1279e07782f8d27d 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2000-2005 The OpenLDAP Foundation.
+ * Copyright 2000-2007 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,7 @@
 #      define  SLAP_BDB_ALLOW_DIRTY_READ
 #endif
 
-#define bdb_cf_gen                     BDB_SYMBOL(cf_gen)
+#define bdb_cf_gen             BDB_SYMBOL(cf_gen)
 #define        bdb_cf_cleanup          BDB_SYMBOL(cf_cleanup)
 #define bdb_checkpoint         BDB_SYMBOL(checkpoint)
 #define bdb_online_index       BDB_SYMBOL(online_index)
@@ -140,7 +140,7 @@ static ConfigOCs bdbocs[] = {
                "olcDbNoSync $ olcDbDirtyRead $ olcDbIDLcacheSize $ "
                "olcDbIndex $ olcDbLinearIndex $ olcDbLockDetect $ "
                "olcDbMode $ olcDbSearchStack $ olcDbShmKey $ "
-               " olcDbCacheFree ) )",
+               "olcDbCacheFree ) )",
                        Cft_Database, bdbcfg },
        { NULL, 0, NULL }
 };
@@ -272,7 +272,9 @@ bdb_online_index( void *ctx, void *arg )
        }
 
        for ( i = 0; i < bdb->bi_nattrs; i++ ) {
-               if ( bdb->bi_attrs[ i ]->ai_indexmask & BDB_INDEX_DELETING ) {
+               if ( bdb->bi_attrs[ i ]->ai_indexmask & BDB_INDEX_DELETING
+                       || bdb->bi_attrs[ i ]->ai_newmask == 0 )
+               {
                        continue;
                }
                bdb->bi_attrs[ i ]->ai_indexmask = bdb->bi_attrs[ i ]->ai_newmask;
@@ -331,7 +333,7 @@ bdb_cf_cleanup( ConfigArgs *c )
 }
 
 static int
-bdb_cf_gen(ConfigArgs *c)
+bdb_cf_gen( ConfigArgs *c )
 {
        struct bdb_info *bdb = c->be->be_private;
        int rc;
@@ -340,7 +342,7 @@ bdb_cf_gen(ConfigArgs *c)
                rc = 0;
                switch( c->type ) {
                case BDB_CHKPT:
-                       if (bdb->bi_txn_cp ) {
+                       if ( bdb->bi_txn_cp ) {
                                char buf[64];
                                struct berval bv;
                                bv.bv_len = sprintf( buf, "%d %d", bdb->bi_txn_cp_kbyte,
@@ -361,8 +363,10 @@ bdb_cf_gen(ConfigArgs *c)
                        break;
 
                case BDB_CONFIG:
-                       if (( slapMode&SLAP_SERVER_MODE ) && !( bdb->bi_flags&BDB_IS_OPEN )
-                               && !bdb->bi_db_config ) {
+                       if ( ( slapMode & SLAP_SERVER_MODE )
+                               && !( bdb->bi_flags & BDB_IS_OPEN )
+                               && !bdb->bi_db_config )
+                       {
                                char    buf[SLAP_TEXT_BUFLEN];
                                FILE *f = fopen( bdb->bi_db_config_path, "r" );
                                struct berval bv;
@@ -440,7 +444,7 @@ bdb_cf_gen(ConfigArgs *c)
                        if ( bdb->bi_txn_cp_task ) {
                                struct re_s *re = bdb->bi_txn_cp_task;
                                bdb->bi_txn_cp_task = NULL;
-                               if ( ldap_pvt_runqueue_isrunning( &slapd_rq, re ))
+                               if ( ldap_pvt_runqueue_isrunning( &slapd_rq, re ) )
                                        ldap_pvt_runqueue_stoptask( &slapd_rq, re );
                                ldap_pvt_runqueue_remove( &slapd_rq, re );
                        }
@@ -488,7 +492,7 @@ bdb_cf_gen(ConfigArgs *c)
                                struct berval bv, def = BER_BVC("default");
                                char *ptr;
 
-                               for (ptr = c->line; !isspace( *ptr ); ptr++);
+                               for (ptr = c->line; !isspace( (unsigned char) *ptr ); ptr++);
 
                                bv.bv_val = c->line;
                                bv.bv_len = ptr - bv.bv_val;
@@ -576,8 +580,8 @@ bdb_cf_gen(ConfigArgs *c)
 
                if ( c->op == SLAP_CONFIG_ADD ) {
                        ptr += STRLENOF("dbconfig");
-                       while (!isspace(*ptr)) ptr++;
-                       while (isspace(*ptr)) ptr++;
+                       while (!isspace((unsigned char)*ptr)) ptr++;
+                       while (isspace((unsigned char)*ptr)) ptr++;
                }
 
                if ( bdb->bi_flags & BDB_IS_OPEN ) {