From da8cb1d91e1f1cacbb7ff1064dc3902ea059ebaf Mon Sep 17 00:00:00 2001 From: Tom Yu Date: Sat, 19 Feb 2000 01:49:31 +0000 Subject: [PATCH] * kdb_cpw.c (krb5_dbe_crk): (krb5_dbe_cpw): Fix to actually save old keys. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@12054 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/kdb/ChangeLog | 5 +++++ src/lib/kdb/kdb_cpw.c | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/src/lib/kdb/ChangeLog b/src/lib/kdb/ChangeLog index b3328a0d8..699e523e8 100644 --- a/src/lib/kdb/ChangeLog +++ b/src/lib/kdb/ChangeLog @@ -1,3 +1,8 @@ +2000-02-18 Tom Yu + + * kdb_cpw.c (krb5_dbe_crk): + (krb5_dbe_cpw): Fix to actually save old keys. + 1999-10-26 Tom Yu * Makefile.in: Clean up usage of CFLAGS, CPPFLAGS, DEFS, DEFINES, diff --git a/src/lib/kdb/kdb_cpw.c b/src/lib/kdb/kdb_cpw.c index 5f1bd15dc..d5f0f3676 100644 --- a/src/lib/kdb/kdb_cpw.c +++ b/src/lib/kdb/kdb_cpw.c @@ -206,6 +206,7 @@ krb5_dbe_crk(context, master_key, ks_tuple, ks_tuple_count, keepold, db_entry) krb5_db_entry * db_entry; { int key_data_count; + int n_new_key_data; krb5_key_data * key_data; krb5_error_code retval; int kvno; @@ -228,6 +229,7 @@ krb5_dbe_crk(context, master_key, ks_tuple, ks_tuple_count, keepold, db_entry) db_entry->n_key_data = key_data_count; db_entry->key_data = key_data; } else if (keepold) { + n_new_key_data = db_entry->n_key_data; for (i = 0; i < key_data_count; i++) { retval = krb5_dbe_create_key_data(context, db_entry); if (retval) { @@ -235,6 +237,8 @@ krb5_dbe_crk(context, master_key, ks_tuple, ks_tuple_count, keepold, db_entry) db_entry->key_data); break; } + db_entry->key_data[i+n_new_key_data] = key_data[i]; + memset(&key_data[i], 0, sizeof(krb5_key_data)); } } else { cleanup_key_data(context, key_data_count, key_data); @@ -451,6 +455,7 @@ krb5_dbe_cpw(context, master_key, ks_tuple, ks_tuple_count, passwd, krb5_db_entry * db_entry; { int key_data_count; + int n_new_key_data; krb5_key_data * key_data; krb5_error_code retval; int old_kvno; @@ -476,6 +481,7 @@ krb5_dbe_cpw(context, master_key, ks_tuple, ks_tuple_count, passwd, db_entry->n_key_data = key_data_count; db_entry->key_data = key_data; } else if (keepold) { + n_new_key_data = db_entry->n_key_data; for (i = 0; i < key_data_count; i++) { retval = krb5_dbe_create_key_data(context, db_entry); if (retval) { @@ -483,6 +489,8 @@ krb5_dbe_cpw(context, master_key, ks_tuple, ks_tuple_count, passwd, db_entry->key_data); break; } + db_entry->key_data[i+n_new_key_data] = key_data[i]; + memset(&key_data[i], 0, sizeof(krb5_key_data)); } } else { cleanup_key_data(context, key_data_count, key_data); -- 2.26.2