(main): use krb5_prepend_config_files_default, now all options in

kdc.conf is parsed, not just [kdc]key-file=


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@12585 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2003-08-18 06:03:42 +00:00
parent 027455cbf0
commit 9883b1f3e5
2 changed files with 26 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997 - 2001 Kungliga Tekniska H<>gskolan * Copyright (c) 1997 - 2001, 2003 Kungliga Tekniska H<>gskolan
* (Royal Institute of Technology, Stockholm, Sweden). * (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved. * All rights reserved.
* *
@@ -221,7 +221,7 @@ int
main(int argc, char **argv) main(int argc, char **argv)
{ {
krb5_error_code ret; krb5_error_code ret;
krb5_config_section *cf = NULL; char **files;
kadm5_config_params conf; kadm5_config_params conf;
int optind = 0; int optind = 0;
@@ -248,8 +248,17 @@ main(int argc, char **argv)
if (config_file == NULL) if (config_file == NULL)
config_file = HDB_DB_DIR "/kdc.conf"; config_file = HDB_DB_DIR "/kdc.conf";
if(krb5_config_parse_file(context, config_file, &cf) == 0) { ret = krb5_prepend_config_files_default(config_file, &files);
const char *p = krb5_config_get_string (context, cf, if (ret)
krb5_err(context, 1, ret, "getting configuration files");
ret = krb5_set_config_files(context, files);
krb5_free_config_files(files);
if(ret)
krb5_err(context, 1, ret, "reading configuration files");
{
const char *p = krb5_config_get_string (context, NULL,
"kdc", "key-file", NULL); "kdc", "key-file", NULL);
if (p) if (p)
keyfile = strdup(p); keyfile = strdup(p);
@@ -316,7 +325,6 @@ main(int argc, char **argv)
ret = sl_loop (actual_cmds, "kadmin> ") != 0; ret = sl_loop (actual_cmds, "kadmin> ") != 0;
kadm5_destroy(kadm_handle); kadm5_destroy(kadm_handle);
krb5_config_file_free (context, cf);
krb5_free_context(context); krb5_free_context(context);
return ret; return ret;
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997-2002 Kungliga Tekniska H<>gskolan * Copyright (c) 1997-2003 Kungliga Tekniska H<>gskolan
* (Royal Institute of Technology, Stockholm, Sweden). * (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved. * All rights reserved.
* *
@@ -100,7 +100,7 @@ int
main(int argc, char **argv) main(int argc, char **argv)
{ {
krb5_error_code ret; krb5_error_code ret;
krb5_config_section *cf; char **files;
int optind = 0; int optind = 0;
int e; int e;
krb5_log_facility *logf; krb5_log_facility *logf;
@@ -136,8 +136,17 @@ main(int argc, char **argv)
if (config_file == NULL) if (config_file == NULL)
config_file = HDB_DB_DIR "/kdc.conf"; config_file = HDB_DB_DIR "/kdc.conf";
if(krb5_config_parse_file(context, config_file, &cf) == 0) { ret = krb5_prepend_config_files_default(config_file, &files);
const char *p = krb5_config_get_string (context, cf, if (ret)
krb5_err(context, 1, ret, "getting configuration files");
ret = krb5_set_config_files(context, files);
krb5_free_config_files(files);
if(ret)
krb5_err(context, 1, ret, "reading configuration files");
{
const char *p = krb5_config_get_string (context, NULL,
"kdc", "key-file", NULL); "kdc", "key-file", NULL);
if (p) if (p)
keyfile = strdup(p); keyfile = strdup(p);