From: Tom Yu Date: Sat, 1 Jul 2000 00:31:06 +0000 (+0000) Subject: * dump.c: Add a new dump version, r1_3_version, and make it the X-Git-Tag: krb5-1.3-alpha1~2041 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7d348b141e39e286d544f0d72173a1a60f6ce434;p=krb5.git * dump.c: Add a new dump version, r1_3_version, and make it the default; it will be used in krb5-1.3 and will permit a principal's kadm5 data to be dumped. This is an interim measure until we redesign the dump format somewhat. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@12496 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/kadmin/dbutil/ChangeLog b/src/kadmin/dbutil/ChangeLog index 1aa379e59..01c2f5e8e 100644 --- a/src/kadmin/dbutil/ChangeLog +++ b/src/kadmin/dbutil/ChangeLog @@ -1,3 +1,10 @@ +2000-06-30 Tom Yu + + * dump.c: Add a new dump version, r1_3_version, and make it the + default; it will be used in krb5-1.3 and will permit a principal's + kadm5 data to be dumped. This is an interim measure until we + redesign the dump format somewhat. + 2000-05-31 Wilfredo Sanchez * ovload.c: Check for existance of . diff --git a/src/kadmin/dbutil/dump.c b/src/kadmin/dbutil/dump.c index 4378e310c..49e49f727 100644 --- a/src/kadmin/dbutil/dump.c +++ b/src/kadmin/dbutil/dump.c @@ -74,8 +74,16 @@ static krb5_error_code dump_k5beta_iterator PROTOTYPE((krb5_pointer, krb5_db_entry *)); static krb5_error_code dump_k5beta6_iterator PROTOTYPE((krb5_pointer, krb5_db_entry *)); +static krb5_error_code dump_k5beta6_iterator_ext PROTOTYPE((krb5_pointer, + krb5_db_entry *, + int)); static krb5_error_code dump_k5beta7_princ PROTOTYPE((krb5_pointer, krb5_db_entry *)); +static krb5_error_code dump_k5beta7_princ_ext PROTOTYPE((krb5_pointer, + krb5_db_entry *, + int)); +static krb5_error_code dump_k5beta7_princ_withpolicy + PROTOTYPE((krb5_pointer, krb5_db_entry *)); static krb5_error_code dump_ov_princ PROTOTYPE((krb5_pointer, krb5_db_entry *)); static void dump_k5beta7_policy PROTOTYPE((void *, osa_policy_ent_t)); @@ -141,6 +149,16 @@ dump_version ov_version = { process_ov_record, }; +dump_version r1_3_version = { + "Kerberos version 5 release 1.3", + "kdb5_util load_dump version 5\n", + 0, + 0, + dump_k5beta7_princ_withpolicy, + dump_k5beta7_policy, + process_k5beta7_record, +}; + /* External data */ extern char *current_dbname; extern krb5_boolean dbactive; @@ -220,6 +238,7 @@ static const char dfile_err_fmt[] = "%s: cannot open %s (%s)\n"; static const char oldoption[] = "-old"; static const char b6option[] = "-b6"; +static const char b7option[] = "-b7"; static const char verboseoption[] = "-verbose"; static const char updateoption[] = "-update"; static const char hashoption[] = "-hash"; @@ -633,6 +652,15 @@ static krb5_error_code dump_k5beta6_iterator(ptr, entry) krb5_pointer ptr; krb5_db_entry *entry; +{ + return dump_k5beta6_iterator_ext(ptr, entry, 0); +} + +static krb5_error_code +dump_k5beta6_iterator_ext(ptr, entry, kadm) + krb5_pointer ptr; + krb5_db_entry *entry; + int kadm; { krb5_error_code retval; struct dump_args *arg; @@ -703,7 +731,10 @@ dump_k5beta6_iterator(ptr, entry) */ switch (tlp->tl_data_type) { case KRB5_TL_KADM_DATA: - skip++; + if (kadm) + counter++; + else + skip++; break; default: counter++; @@ -731,7 +762,7 @@ dump_k5beta6_iterator(ptr, entry) entry->fail_auth_count); /* Pound out tagged data. */ for (tlp = entry->tl_data; tlp; tlp = tlp->tl_data_next) { - if (tlp->tl_data_type == KRB5_TL_KADM_DATA) + if (tlp->tl_data_type == KRB5_TL_KADM_DATA && !kadm) continue; /* see above, [krb5-admin/89] */ fprintf(arg->ofile, "%d\t%d\t", @@ -796,6 +827,15 @@ static krb5_error_code dump_k5beta7_princ(ptr, entry) krb5_pointer ptr; krb5_db_entry *entry; +{ + return dump_k5beta7_princ_ext(ptr, entry, 0); +} + +static krb5_error_code +dump_k5beta7_princ_ext(ptr, entry, kadm) + krb5_pointer ptr; + krb5_db_entry *entry; + int kadm; { krb5_error_code retval; struct dump_args *arg; @@ -826,7 +866,7 @@ dump_k5beta7_princ(ptr, entry) /* save the callee from matching the name again */ tmp_nnames = arg->nnames; arg->nnames = 0; - retval = dump_k5beta6_iterator(ptr, entry); + retval = dump_k5beta6_iterator_ext(ptr, entry, kadm); arg->nnames = tmp_nnames; } @@ -834,6 +874,14 @@ dump_k5beta7_princ(ptr, entry) return retval; } +static krb5_error_code +dump_k5beta7_princ_withpolicy(ptr, entry) + krb5_pointer ptr; + krb5_db_entry *entry; +{ + return dump_k5beta7_princ_ext(ptr, entry, 1); +} + void dump_k5beta7_policy(void *data, osa_policy_ent_t entry) { struct dump_args *arg; @@ -953,7 +1001,7 @@ static krb5_error_code dump_ov_princ(krb5_pointer ptr, krb5_db_entry *kdb) /* * usage is: - * dump_db [-old] [-b6] [-ov] [-verbose] [filename [principals...]] + * dump_db [-old] [-b6] [-b7] [-ov] [-verbose] [filename [principals...]] */ void dump_db(argc, argv) @@ -980,7 +1028,7 @@ dump_db(argc, argv) programname = strrchr(argv[0], (int) '/') + 1; ofile = (char *) NULL; error = 0; - dump = &beta7_version; + dump = &r1_3_version; arglist.verbose = 0; new_mkey_file = 0; mkey_convert = 0; @@ -993,6 +1041,8 @@ dump_db(argc, argv) dump = &old_version; else if (!strcmp(argv[aindex], b6option)) dump = &beta6_version; + else if (!strcmp(argv[aindex], b7option)) + dump = &beta7_version; else if (!strcmp(argv[aindex], ovoption)) dump = &ov_version; else if (!strcmp(argv[aindex], verboseoption)) @@ -2008,7 +2058,8 @@ restore_dump(programname, kcontext, dumpfile, f, verbose, dump, pol_db) } /* - * Usage: load_db [-old] [-ov] [-b6] [-verbose] [-update] [-hash] filename + * Usage: load_db [-old] [-ov] [-b6] [-b7] [-verbose] [-update] [-hash] + * filename */ void load_db(argc, argv) @@ -2052,6 +2103,8 @@ load_db(argc, argv) load = &old_version; else if (!strcmp(argv[aindex], b6option)) load = &beta6_version; + else if (!strcmp(argv[aindex], b7option)) + load = &beta7_version; else if (!strcmp(argv[aindex], ovoption)) load = &ov_version; else if (!strcmp(argv[aindex], verboseoption)) @@ -2129,6 +2182,8 @@ load_db(argc, argv) load = &beta6_version; else if (strcmp(buf, beta7_version.header) == 0) load = &beta7_version; + else if (strcmp(buf, r1_3_version.header) == 0) + load = &r1_3_version; else if (strncmp(buf, ov_version.header, strlen(ov_version.header)) == 0) load = &ov_version;