svn rev #21771: branches/mkey_migrate/src/ kadmin/dbutil/ lib/kdb/

wfiveash@MIT.EDU wfiveash at MIT.EDU
Wed Jan 21 17:30:58 EST 2009


http://src.mit.edu/fisheye/changelog/krb5/?cs=21771
Commit By: wfiveash
Log Message:
Modified krb5_db_fetch_mkey() to use the enctype in the stash file.
After making this modification 917 dejagnu tests pass (did not see any
failures on my Solaris test system).



Changed Files:
U   branches/mkey_migrate/src/kadmin/dbutil/kdb5_mkey.c
U   branches/mkey_migrate/src/kadmin/dbutil/kdb5_util.c
U   branches/mkey_migrate/src/lib/kdb/kdb5.c
Modified: branches/mkey_migrate/src/kadmin/dbutil/kdb5_mkey.c
===================================================================
--- branches/mkey_migrate/src/kadmin/dbutil/kdb5_mkey.c	2009-01-21 19:38:12 UTC (rev 21770)
+++ branches/mkey_migrate/src/kadmin/dbutil/kdb5_mkey.c	2009-01-21 22:30:56 UTC (rev 21771)
@@ -49,7 +49,7 @@
     krb5_kvno old_kvno, new_mkey_kvno;
     krb5_keyblock new_master_keyblock;
     krb5_key_data tmp_key_data, *old_key_data;
-    krb5_enctype new_master_enctype;
+    krb5_enctype new_master_enctype = ENCTYPE_UNKNOWN;
     char *new_mkey_password;
     krb5_db_entry master_entry;
     krb5_timestamp now;
@@ -65,7 +65,7 @@
     while ((optchar = getopt(argc, argv, "e:s")) != -1) {
         switch(optchar) {
         case 'e':
-            if (krb5_string_to_enctype(optarg, &global_params.enctype)) {
+            if (krb5_string_to_enctype(optarg, &new_master_enctype)) {
                 com_err(progname, EINVAL, ": %s is an invalid enctype", optarg);
                 exit_status++;
                 return;
@@ -81,7 +81,8 @@
         }
     }
 
-    new_master_enctype = global_params.enctype;
+    if (new_master_enctype == ENCTYPE_UNKNOWN)
+        new_master_enctype = global_params.enctype;
 
     /* assemble & parse the master key name */
     if ((retval = krb5_db_setup_mkey_name(util_context,
@@ -331,7 +332,8 @@
         }
     }
 
-    printf("i = %d old_key_data_count = %d\n", i, old_key_data_count);
+    /* XXX WAF: debug printf, remove before final commit */
+    /* printf("i = %d old_key_data_count = %d\n", i, old_key_data_count); */
     assert(i == old_key_data_count + 1);
 
     if ((retval = krb5_dbe_update_mkey_aux(util_context, &master_entry,
@@ -662,7 +664,7 @@
                 asprintf(&output_str, "KNVO: %d, Enctype: %s, Active on: %s\n",
                          cur_kb_node->kvno, enctype, strdate(act_time));
             } else {
-                asprintf(&output_str, "KNVO: %d, Enctype: %s, Not activated\n",
+                asprintf(&output_str, "KNVO: %d, Enctype: %s, No activate time set\n",
                          cur_kb_node->kvno, enctype);
             }
         }

Modified: branches/mkey_migrate/src/kadmin/dbutil/kdb5_util.c
===================================================================
--- branches/mkey_migrate/src/kadmin/dbutil/kdb5_util.c	2009-01-21 19:38:12 UTC (rev 21770)
+++ branches/mkey_migrate/src/kadmin/dbutil/kdb5_util.c	2009-01-21 22:30:56 UTC (rev 21771)
@@ -474,8 +474,6 @@
 	mkey_password = 0;
 
     } else {
-        /* let the stash decide the enctype */
-        master_keyblock.enctype = ENCTYPE_UNKNOWN;
         if ((retval = krb5_db_fetch_mkey(util_context, master_princ, 
 					    master_keyblock.enctype,
 					    manual_mkey, FALSE,
@@ -508,7 +506,7 @@
     }
 
     seed.length = master_keyblock.length;
-    seed.data = master_keyblock.contents;
+    seed.data = (char *) master_keyblock.contents;
 
     if ((retval = krb5_c_random_seed(util_context, &seed))) {
 	com_err(progname, retval, "while seeding random number generator");

Modified: branches/mkey_migrate/src/lib/kdb/kdb5.c
===================================================================
--- branches/mkey_migrate/src/lib/kdb/kdb5.c	2009-01-21 19:38:12 UTC (rev 21770)
+++ branches/mkey_migrate/src/lib/kdb/kdb5.c	2009-01-21 22:30:56 UTC (rev 21771)
@@ -1702,7 +1702,9 @@
 	    goto clean_n_exit;
 	}
 
-	tmp_key.enctype = key->enctype;
+        /* get the enctype from the stash */
+	tmp_key.enctype = ENCTYPE_UNKNOWN;
+
 	retval = dal_handle->lib_handle->vftabl.fetch_master_key(context,
 								 mname,
 								 &tmp_key,




More information about the cvs-krb5 mailing list