Thu Aug 1 14:34:51 1996 Barry Jaspan <bjaspan@DUN-DUN-NOODLES>
+ * 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.
#include <kdc.h>
#include <stdio.h>
+#include <kadm5/admin.h>
#include "kdb5_util.h"
struct dump_record {
extern krb5_boolean dbactive;
extern int exit_status;
extern krb5_context util_context;
+extern kadm5_config_params global_params;
void update_ok_file();
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);
}
#include "k5-int.h"
#include "com_err.h"
-#include "adm.h"
-#include "adm_proto.h"
+#include <kadm5/admin.h>
#include <stdio.h>
#include <netinet/in.h> /* ntohl */
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);
(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;
}