* dump.c (dump_k5beta6_iterator): don't dump tl types that are
authorBarry Jaspan <bjaspan@mit.edu>
Fri, 18 Oct 1996 20:11:03 +0000 (20:11 +0000)
committerBarry Jaspan <bjaspan@mit.edu>
Fri, 18 Oct 1996 20:11:03 +0000 (20:11 +0000)
  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
src/kadmin/dbutil/dump.c

index fef1e7ab712601406543df3fbca991d25a93fa73..3f8d54f2e23574271e578788c95dc4028bf6f864 100644 (file)
@@ -3,6 +3,10 @@ Fri Oct 18 14:23:41 1996  Barry Jaspan  <bjaspan@mit.edu>
        * 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  <bjaspan@mit.edu>
 
        * dump.c (load_db): rework the way policy database naming and
index 3bbdddd2d3fe9fd0645142e968fbe1e6eeb87104..6d82222c647eeb06d2498f463bbcbbd8ce828ae3 100644 (file)
@@ -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);