From 1017d42b1804c787f0aa9b303bc651732c3157b6 Mon Sep 17 00:00:00 2001 From: "Roland C. Dowdeswell" Date: Thu, 23 Feb 2012 13:20:02 +0000 Subject: [PATCH] We honour settings to specify the location of the KDB and stash file. --- lib/kadm5/init_s.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/lib/kadm5/init_s.c b/lib/kadm5/init_s.c index 1001fce6d..a69bda1b3 100644 --- a/lib/kadm5/init_s.c +++ b/lib/kadm5/init_s.c @@ -47,12 +47,25 @@ kadm5_s_init_with_context(krb5_context context, { kadm5_ret_t ret; kadm5_server_context *ctx; + char *dbname; + char *stash_file; + ret = _kadm5_s_init_context(&ctx, realm_params, context); if(ret) return ret; - assert(ctx->config.dbname != NULL); - assert(ctx->config.stash_file != NULL); + if (realm_params->mask & KADM5_CONFIG_DBNAME) + dbname = realm_params->dbname; + else + dbname = ctx->config.dbname; + + if (realm_params->mask & KADM5_CONFIG_STASH_FILE) + stash_file = realm_params->stash_file; + else + stash_file = ctx->config.stash_file; + + assert(dbname != NULL); + assert(stash_file != NULL); assert(ctx->config.acl_file != NULL); assert(ctx->log_context.log_file != NULL); #ifndef NO_UNIX_SOCKETS @@ -61,11 +74,11 @@ kadm5_s_init_with_context(krb5_context context, assert(ctx->log_context.socket_info != NULL); #endif - ret = hdb_create(ctx->context, &ctx->db, ctx->config.dbname); + ret = hdb_create(ctx->context, &ctx->db, dbname); if(ret) return ret; ret = hdb_set_master_keyfile (ctx->context, - ctx->db, ctx->config.stash_file); + ctx->db, stash_file); if(ret) return ret;