We honour settings to specify the location of the KDB and stash file.

This commit is contained in:
Roland C. Dowdeswell
2012-02-23 13:20:02 +00:00
parent e8779d5d4a
commit 1017d42b18

View File

@@ -47,12 +47,25 @@ kadm5_s_init_with_context(krb5_context context,
{ {
kadm5_ret_t ret; kadm5_ret_t ret;
kadm5_server_context *ctx; kadm5_server_context *ctx;
char *dbname;
char *stash_file;
ret = _kadm5_s_init_context(&ctx, realm_params, context); ret = _kadm5_s_init_context(&ctx, realm_params, context);
if(ret) if(ret)
return ret; return ret;
assert(ctx->config.dbname != NULL); if (realm_params->mask & KADM5_CONFIG_DBNAME)
assert(ctx->config.stash_file != NULL); 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->config.acl_file != NULL);
assert(ctx->log_context.log_file != NULL); assert(ctx->log_context.log_file != NULL);
#ifndef NO_UNIX_SOCKETS #ifndef NO_UNIX_SOCKETS
@@ -61,11 +74,11 @@ kadm5_s_init_with_context(krb5_context context,
assert(ctx->log_context.socket_info != NULL); assert(ctx->log_context.socket_info != NULL);
#endif #endif
ret = hdb_create(ctx->context, &ctx->db, ctx->config.dbname); ret = hdb_create(ctx->context, &ctx->db, dbname);
if(ret) if(ret)
return ret; return ret;
ret = hdb_set_master_keyfile (ctx->context, ret = hdb_set_master_keyfile (ctx->context,
ctx->db, ctx->config.stash_file); ctx->db, stash_file);
if(ret) if(ret)
return ret; return ret;