use hdb_db_dir() and hdb_default_db()

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@22211 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2007-12-07 19:27:27 +00:00
parent e0d4ec6201
commit 284d45bbbc
8 changed files with 50 additions and 22 deletions

View File

@@ -1,3 +1,7 @@
2007-12-07 Love H<>rnquist <20>strand <lha@it.su.se>
* use hdb_db_dir() and hdb_default_db()
2007-10-18 Love <lha@stacken.kth.se>
* init_c.c: We are getting default_client, not client. this way

View File

@@ -107,13 +107,13 @@ find_db_spec(kadm5_server_context *ctx)
/* If any of the values was unset, pick up the default value */
if (ctx->config.dbname == NULL)
ctx->config.dbname = strdup(HDB_DEFAULT_DB);
ctx->config.dbname = strdup(hdb_default_db(context));
if (ctx->config.acl_file == NULL)
ctx->config.acl_file = strdup(HDB_DB_DIR "/kadmind.acl");
asprintf(&ctx->config.acl_file, "%s/kadmind.acl", hdb_db_dir(context));
if (ctx->config.stash_file == NULL)
ctx->config.stash_file = strdup(HDB_DB_DIR "/m-key");
asprintf(&ctx->config.stash_file, "%s/m-key", hdb_db_dir(context));
if (ctx->log_context.log_file == NULL)
ctx->log_context.log_file = strdup(HDB_DB_DIR "/log");
asprintf(&ctx->log_context.log_file, "%s/log", hdb_db_dir(context));
set_socket_name(context, &ctx->log_context.socket_name);

View File

@@ -48,8 +48,13 @@ get_kadmin_context(const char *config_file, char *realm)
void *kadm_handle;
char **files;
if (config_file == NULL)
config_file = HDB_DB_DIR "/kdc.conf";
if (config_file == NULL) {
char *file;
asprintf(&file, "%s/kdc.conf", hdb_db_dir(context));
if (file == NULL)
errx(1, "out of memory");
config_file = file;
}
ret = krb5_prepend_config_files_default(config_file, &files);
if (ret)

View File

@@ -49,10 +49,6 @@
#define IPROP_VERSION "iprop-0.0"
#define KADM5_SLAVE_ACL HDB_DB_DIR "/slaves"
#define KADM5_SLAVE_STATS HDB_DB_DIR "/slaves-stats"
#define IPROP_NAME "iprop"
#define IPROP_SERVICE "iprop"

View File

@@ -128,16 +128,19 @@ check_acl (krb5_context context, const char *name)
FILE *fp;
char buf[256];
int ret = 1;
char *slavefile;
asprintf(&slavefile, "%s/slaves", hdb_db_dir(context));
fn = krb5_config_get_string_default(context,
NULL,
KADM5_SLAVE_ACL,
slavefile,
"kdc",
"iprop-acl",
NULL);
fp = fopen (fn, "r");
free(slavefile);
if (fp == NULL)
return 1;
while (fgets(buf, sizeof(buf), fp) != NULL) {
@@ -592,19 +595,26 @@ process_msg (krb5_context context, slave *s, int log_fd,
static FILE *
open_stats(krb5_context context)
{
char *statfile = NULL;
const char *fn;
FILE *f;
if (slave_stats_file)
fn = slave_stats_file;
else
else {
asprintf(&statfile, "%s/slaves-stats", hdb_db_dir(context));
fn = krb5_config_get_string_default(context,
NULL,
KADM5_SLAVE_STATS,
statfile,
"kdc",
"iprop-stats",
NULL);
}
f = fopen(fn, "w");
if (statfile)
free(statfile);
return fopen(fn, "w");
return f;
}
static void
@@ -748,8 +758,11 @@ main(int argc, char **argv)
setup_signal();
if (config_file == NULL)
config_file = HDB_DB_DIR "/kdc.conf";
if (config_file == NULL) {
asprintf(&config_file, "%s/kdc.conf", hdb_db_dir(context));
if (config_file == NULL)
errx(1, "out of memory");
}
ret = krb5_prepend_config_files_default(config_file, &files);
if (ret)

View File

@@ -480,8 +480,11 @@ main(int argc, char **argv)
setup_signal();
if (config_file == NULL)
config_file = HDB_DB_DIR "/kdc.conf";
if (config_file == NULL) {
asprintf(&config_file, "%s/kdc.conf", hdb_db_dir(context));
if (config_file == NULL)
errx(1, "out of memory");
}
ret = krb5_prepend_config_files_default(config_file, &files);
if (ret)

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997 - 2006 Kungliga Tekniska H<>gskolan
* Copyright (c) 1997 - 2007 Kungliga Tekniska H<>gskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -32,6 +32,7 @@
*/
#include "kadm5_locl.h"
#include "heim_threads.h"
RCSID("$Id$");
@@ -961,12 +962,20 @@ kadm5_log_truncate (kadm5_server_context *server_context)
}
static char *default_signal = NULL;
static HEIMDAL_MUTEX signal_mutex = HEIMDAL_MUTEX_INITIALIZER;
const char *
kadm5_log_signal_socket(krb5_context context)
{
HEIMDAL_MUTEX_lock(&signal_mutex);
if (!default_signal)
asprintf(&default_signal, "%s/signal", hdb_db_dir(context));
HEIMDAL_MUTEX_unlock(&signal_mutex);
return krb5_config_get_string_default(context,
NULL,
KADM5_LOG_SIGNAL,
default_signal,
"kdc",
"signal_socket",
NULL);

View File

@@ -139,8 +139,6 @@ enum kadm_ops {
#define KADMIN_APPL_VERSION "KADM0.1"
#define KADMIN_OLD_APPL_VERSION "KADM0.0"
#define KADM5_LOG_SIGNAL HDB_DB_DIR "/signal"
#include "kadm5-private.h"
#endif /* __kadm5_privatex_h__ */