From a4b9cab04fe8accf237a7d14aa93dfde191e4dd8 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Mon, 18 Nov 2013 20:39:35 -0800 Subject: [PATCH] ITS#7750 fix olcDbConfig modification --- servers/slapd/back-bdb/config.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 ); -- 2.39.5