From 6cd11b007056d57e88b0d85b6010c66ae3b9c20d Mon Sep 17 00:00:00 2001 From: Barry Jaspan Date: Thu, 1 Aug 1996 19:08:22 +0000 Subject: [PATCH] * loadv4.c: create empty policy database after loading V4 dump file * dumpv4.c (dump_v4db): use global_params.stash_file git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@8890 dc483132-0cff-0310-8789-dd5450dbe970 --- src/kadmin/dbutil/ChangeLog | 4 ++++ src/kadmin/dbutil/dumpv4.c | 5 ++++- src/kadmin/dbutil/loadv4.c | 32 ++++++++++++++++++++++++++++++-- 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/src/kadmin/dbutil/ChangeLog b/src/kadmin/dbutil/ChangeLog index 8c8aa4ce2..82e18f593 100644 --- a/src/kadmin/dbutil/ChangeLog +++ b/src/kadmin/dbutil/ChangeLog @@ -1,5 +1,9 @@ Thu Aug 1 14:34:51 1996 Barry Jaspan + * loadv4.c: create empty policy database after loading V4 dump file + + * dumpv4.c (dump_v4db): use global_params.stash_file + * Makefile.in, Makefile.ov, configure.in, dump.c: add support for dump/load of OV*Secure-compatible format. diff --git a/src/kadmin/dbutil/dumpv4.c b/src/kadmin/dbutil/dumpv4.c index a51626db3..8c85e8f1b 100644 --- a/src/kadmin/dbutil/dumpv4.c +++ b/src/kadmin/dbutil/dumpv4.c @@ -36,6 +36,7 @@ #include #include +#include #include "kdb5_util.h" struct dump_record { @@ -54,6 +55,7 @@ extern krb5_principal master_princ; extern krb5_boolean dbactive; extern int exit_status; extern krb5_context util_context; +extern kadm5_config_params global_params; void update_ok_file(); @@ -352,7 +354,8 @@ int handle_keys(arg) krb5_use_enctype(util_context, &master_encblock, DEFAULT_KDC_ENCTYPE); if (retval = krb5_db_fetch_mkey(util_context, master_princ, &master_encblock, 0, - 0, (char *) NULL, 0, &master_keyblock)) { + 0, global_params.stash_file, 0, + &master_keyblock)) { com_err(arg->comerr_name, retval, "while reading master key"); exit(1); } diff --git a/src/kadmin/dbutil/loadv4.c b/src/kadmin/dbutil/loadv4.c index a1d37edc7..f4e54a278 100644 --- a/src/kadmin/dbutil/loadv4.c +++ b/src/kadmin/dbutil/loadv4.c @@ -41,8 +41,7 @@ static char *v4_mkeyfile = "/.k"; #include "k5-int.h" #include "com_err.h" -#include "adm.h" -#include "adm_proto.h" +#include #include #include /* ntohl */ @@ -155,6 +154,8 @@ char *argv[]; char *stash_file = (char *) NULL; krb5_realm_params *rparams; int persist, op_ind; + kadm5_config_params newparams; + extern kadm5_config_params global_params; krb5_init_context(&context); @@ -426,6 +427,33 @@ master key name '%s'\n", (void) krb5_finish_key(context, &master_encblock); (void) krb5_finish_random_key(context, &master_encblock, &rblock.rseed); memset((char *)master_keyblock.contents, 0, master_keyblock.length); + + /* + * Cons up config params for new policy database (which will be + * empty). The policy dbname keys off the dbname. + */ + newparams = global_params; + newparams.mask &= ~(KADM5_CONFIG_ADBNAME | KADM5_CONFIG_ADB_LOCKFILE); + newparams.dbname = dbname; + newparams.mask |= KADM5_CONFIG_DBNAME; + if (retval = kadm5_get_config_params(context, NULL, NULL, &newparams, + &newparams)) { + com_err(PROGNAME, retval, "while retrieiving configuration " + "parameters"); + return; + } + /* + * Always create the policy db, even if we are not loading a dump + * file with policy info, because they are probably loading an old + * dump intending to use it with the new kadm5 system (ie: using + * load as create). + */ + if (retval = osa_adb_create_policy_db(&newparams)) { + com_err(PROGNAME, retval, "while creating policy database"); + kadm5_free_config_params(context, &newparams); + return; + } + krb5_free_context(context); return; } -- 2.26.2