From 03b7cc7d7f303643382bb655b56c8c57edfec735 Mon Sep 17 00:00:00 2001 From: Barry Jaspan Date: Fri, 18 Oct 1996 20:11:03 +0000 Subject: [PATCH] * dump.c (dump_k5beta6_iterator): don't dump tl types that are special to us and the previous version did not understand [krb5-admin/89] git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9208 dc483132-0cff-0310-8789-dd5450dbe970 --- src/kadmin/dbutil/ChangeLog | 4 ++++ src/kadmin/dbutil/dump.c | 42 ++++++++++++++++++++++++++++++------- 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/src/kadmin/dbutil/ChangeLog b/src/kadmin/dbutil/ChangeLog index fef1e7ab7..3f8d54f2e 100644 --- a/src/kadmin/dbutil/ChangeLog +++ b/src/kadmin/dbutil/ChangeLog @@ -3,6 +3,10 @@ Fri Oct 18 14:23:41 1996 Barry Jaspan * dump.c (load_db): osa_adb_rename_policy_db will create the db, so this function doesn't have to [krb5-admin/58] + * dump.c (dump_k5beta6_iterator): don't dump tl types that are + special to us and the previous version did not understand + [krb5-admin/89] + Tue Oct 8 13:35:56 1996 Barry Jaspan * dump.c (load_db): rework the way policy database naming and diff --git a/src/kadmin/dbutil/dump.c b/src/kadmin/dbutil/dump.c index 3bbdddd2d..6d82222c6 100644 --- a/src/kadmin/dbutil/dump.c +++ b/src/kadmin/dbutil/dump.c @@ -566,7 +566,7 @@ dump_k5beta6_iterator(ptr, entry) char *name; krb5_tl_data *tlp; krb5_key_data *kdata; - int counter, i, j; + int counter, skip, i, j; /* Initialize */ arg = (struct dump_args *) ptr; @@ -610,15 +610,28 @@ dump_k5beta6_iterator(ptr, entry) /* * Make sure that the tagged list is reasonably correct. */ - counter = 0; - for (tlp = entry->tl_data; tlp; tlp = tlp->tl_data_next) - counter++; - if (counter == entry->n_tl_data) { + counter = skip = 0; + for (tlp = entry->tl_data; tlp; tlp = tlp->tl_data_next) { + /* + * don't dump tl data types we know aren't understood by + * earlier revisions [krb5-admin/89] + */ + switch (tlp->tl_data_type) { + case KRB5_TL_KADM_DATA: + skip++; + break; + default: + counter++; + break; + } + } + + if (counter + skip == entry->n_tl_data) { /* Pound out header */ fprintf(arg->ofile, "%d\t%d\t%d\t%d\t%d\t%s\t", (int) entry->len, strlen(name), - (int) entry->n_tl_data, + counter, (int) entry->n_key_data, (int) entry->e_length, name); @@ -633,6 +646,9 @@ 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) + continue; /* see above, [krb5-admin/89] */ + fprintf(arg->ofile, "%d\t%d\t", (int) tlp->tl_data_type, (int) tlp->tl_data_length); @@ -679,7 +695,8 @@ dump_k5beta6_iterator(ptr, entry) } else { fprintf(stderr, sdump_tl_inc_err, - arg->programname, name, counter, (int) entry->n_tl_data); + arg->programname, name, counter+skip, + (int) entry->n_tl_data); retval = EINVAL; } } @@ -1541,7 +1558,16 @@ process_k5beta6_record(fname, kcontext, filep, verbose, linenop, pol_db) error++; } - /* Get the tagged data */ + /* + * Get the tagged data. + * + * Really, this code ought to discard tl data types + * that it knows are special to the current version + * and were not supported in the previous version. + * But it's a pain to implement that here, and doing + * it at dump time has almost as good an effect, so + * that's what I did. [krb5-admin/89/ + */ if (!error && dbentry.n_tl_data) { for (tl = dbentry.tl_data; tl; tl = tl->tl_data_next) { nread = fscanf(filep, "%d\t%d\t", &t1, &t2); -- 2.26.2