From: Howard Chu Date: Tue, 19 Nov 2013 04:39:35 +0000 (-0800) Subject: ITS#7750 fix olcDbConfig modification X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a4b9cab04fe8accf237a7d14aa93dfde191e4dd8;p=openldap ITS#7750 fix olcDbConfig modification --- diff --git a/servers/slapd/back-bdb/config.c b/servers/slapd/back-bdb/config.c index 7a7d72bfa7..85b1842dce 100644 --- a/servers/slapd/back-bdb/config.c +++ b/servers/slapd/back-bdb/config.c @@ -324,6 +324,7 @@ bdb_cf_cleanup( ConfigArgs *c ) { struct bdb_info *bdb = c->be->be_private; int rc = 0; + BerVarray bva; if ( bdb->bi_flags & BDB_DEL_INDEX ) { bdb_attr_flush( bdb ); @@ -332,16 +333,22 @@ bdb_cf_cleanup( ConfigArgs *c ) if ( bdb->bi_flags & BDB_RE_OPEN ) { bdb->bi_flags ^= BDB_RE_OPEN; + bva = bdb->bi_db_config; + bdb->bi_db_config = NULL; rc = c->be->bd_info->bi_db_close( c->be, &c->reply ); if ( rc == 0 ) { if ( bdb->bi_flags & BDB_UPD_CONFIG ) { - if ( bdb->bi_db_config ) { + if ( bva ) { int i; FILE *f = fopen( bdb->bi_db_config_path, "w" ); if ( f ) { + bdb->bi_db_config = bva; + bva = NULL; for (i=0; bdb->bi_db_config[i].bv_val; i++) fprintf( f, "%s\n", bdb->bi_db_config[i].bv_val ); fclose( f ); + } else { + ber_bvarray_free( bva ); } } else { unlink( bdb->bi_db_config_path );