static const char b6option[] = "-b6";
static const char verboseoption[] = "-verbose";
static const char updateoption[] = "-update";
+static const char hashoption[] = "-hash";
static const char ovoption[] = "-ov";
static const char dump_tmptrail[] = "~";
}
/*
- * Usage: load_db [-old] [-ov] [-b6] [-verbose] [-update] filename
+ * Usage: load_db [-old] [-ov] [-b6] [-verbose] [-update] [-hash] filename
*/
void
load_db(argc, argv)
char buf[BUFSIZ];
dump_version *load;
int update, verbose;
+ krb5_int32 crflags;
int aindex;
/*
load = NULL;
update = 0;
verbose = 0;
+ crflags = KRB5_KDB_CREATE_BTREE;
exit_status = 0;
dbname_tmp = (char *) NULL;
tmppol_db = NULL;
verbose = 1;
else if (!strcmp(argv[aindex], updateoption))
update = 1;
+ else if (!strcmp(argv[aindex], hashoption))
+ crflags = KRB5_KDB_CREATE_HASH;
else
break;
}
* with policy info, because they may be loading an old dump
* intending to use it with the new kadm5 system.
*/
- if (!update && (kret = krb5_db_create(kcontext, dbname_tmp))) {
+ if (!update && (kret = krb5_db_create(kcontext, dbname_tmp, crflags))) {
fprintf(stderr, dbcreaterr_fmt,
programname, dbname_tmp, error_message(kret));
exit_status++;
*/
if (!update) {
if (exit_status) {
- if ((kret = kdb5_db_destroy(kcontext, dbname_tmp))) {
+ if ((kret = krb5_db_destroy(kcontext, dbname_tmp))) {
fprintf(stderr, dbdelerr_fmt,
programname, dbname_tmp, error_message(kret));
exit_status++;
kadm5_config_params newparams;
extern kadm5_config_params global_params;
long exp_time = 0;
+ krb5_int32 crflags = KRB5_KDB_CREATE_BTREE;
retval = krb5_init_context(&context);
if (retval) {
usage();
}
}
+ else if (!strcmp(argv[op_ind], "-h")) {
+ crflags = KRB5_KDB_CREATE_HASH;
+ }
else if ((argc - op_ind) >= 1) {
v4dumpfile = argv[op_ind];
op_ind++;
strcpy(tempdbname, dbname);
tempdbname[dbnamelen] = '~';
tempdbname[dbnamelen+1] = 0;
- (void) kdb5_db_destroy(context, tempdbname);
+ (void) krb5_db_destroy(context, tempdbname);
}
krb5_free_context(context);
return;
}
- if (retval = krb5_db_create(context, tempdbname)) {
+ if (retval = krb5_db_create(context, tempdbname, crflags)) {
(void) krb5_finish_key(context, &master_encblock);
(void) krb5_finish_random_key(context, &master_encblock, &rblock.rseed);
- (void) krb5_dbm_db_destroy(context, tempdbname);
+ (void) krb5_db_destroy(context, tempdbname);
com_err(PROGNAME, retval, "while creating %sdatabase '%s'",
tempdb ? "temporary " : "", tempdbname);
krb5_free_context(context);
if (retval = krb5_db_set_name(context, tempdbname)) {
(void) krb5_finish_key(context, &master_encblock);
(void) krb5_finish_random_key(context, &master_encblock, &rblock.rseed);
- (void) krb5_dbm_db_destroy(context, tempdbname);
+ (void) krb5_db_destroy(context, tempdbname);
com_err(PROGNAME, retval, "while setting active database to '%s'",
tempdbname);
krb5_free_context(context);
if (v4init(PROGNAME, v4manual, v4dumpfile)) {
(void) krb5_finish_key(context, &master_encblock);
(void) krb5_finish_random_key(context, &master_encblock, &rblock.rseed);
- (void) krb5_dbm_db_destroy(context, tempdbname);
+ (void) krb5_db_destroy(context, tempdbname);
krb5_free_context(context);
return;
}
if ((retval = krb5_db_init(context)) ||
- (retval = krb5_dbm_db_open_database(context))) {
+ (retval = krb5_db_open_database(context))) {
(void) krb5_finish_key(context, &master_encblock);
(void) krb5_finish_random_key(context, &master_encblock, &rblock.rseed);
- (void) krb5_dbm_db_destroy(context, tempdbname);
+ (void) krb5_db_destroy(context, tempdbname);
com_err(PROGNAME, retval, "while initializing the database '%s'",
tempdbname);
krb5_free_context(context);
(void) krb5_db_fini(context);
(void) krb5_finish_key(context, &master_encblock);
(void) krb5_finish_random_key(context, &master_encblock, &rblock.rseed);
- (void) krb5_dbm_db_destroy(context, tempdbname);
+ (void) krb5_db_destroy(context, tempdbname);
com_err(PROGNAME, retval, "while adding K/M to the database");
krb5_free_context(context);
return;
(void) krb5_db_fini(context);
(void) krb5_finish_key(context, &master_encblock);
(void) krb5_finish_random_key(context, &master_encblock, &rblock.rseed);
- (void) krb5_dbm_db_destroy(context, tempdbname);
+ (void) krb5_db_destroy(context, tempdbname);
com_err(PROGNAME, retval, "while adding TGT service to the database");
krb5_free_context(context);
return;
if (retval == 0) {
if (retval = krb5_db_fini (context))
com_err(PROGNAME, retval, "while shutting down database");
- else if (tempdb && (retval = krb5_dbm_db_rename(context, tempdbname,
+ else if (tempdb && (retval = krb5_db_rename(context, tempdbname,
dbname)))
com_err(PROGNAME, retval, "while renaming temporary database");
} else {
(void) krb5_db_fini (context);
if (tempdb)
- (void) krb5_dbm_db_destroy (context, tempdbname);
+ (void) krb5_db_destroy (context, tempdbname);
}
(void) krb5_finish_key(context, &master_encblock);
(void) krb5_finish_random_key(context, &master_encblock, &rblock.rseed);