From d6012ef017e13f179cf9846cdac812878cf6eab1 Mon Sep 17 00:00:00 2001 From: Will Fiveash Date: Tue, 10 Mar 2009 20:26:24 +0000 Subject: [PATCH] Several small fixes to enable the migrate mkey commands to work properly with a LDAP KDB. See the ticket for more details ticket: 6405 Tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@22073 dc483132-0cff-0310-8789-dd5450dbe970 --- src/kadmin/dbutil/kdb5_mkey.c | 5 +++ src/lib/kdb/kdb5.c | 2 +- src/plugins/kdb/ldap/libkdb_ldap/kdb_xdr.c | 45 ---------------------- 3 files changed, 6 insertions(+), 46 deletions(-) diff --git a/src/kadmin/dbutil/kdb5_mkey.c b/src/kadmin/dbutil/kdb5_mkey.c index 23e51eb66..7827b2959 100644 --- a/src/kadmin/dbutil/kdb5_mkey.c +++ b/src/kadmin/dbutil/kdb5_mkey.c @@ -185,6 +185,7 @@ add_new_mkey(krb5_context context, krb5_db_entry *master_entry, mkey_aux_data_head))) { goto clean_n_exit; } + master_entry->mask |= KADM5_KEY_DATA; clean_n_exit: krb5_dbe_free_mkey_aux_list(context, mkey_aux_data_head); @@ -906,6 +907,8 @@ update_princ_encryption_1(void *cb, krb5_db_entry *ent) goto fail; } + ent->mask |= KADM5_KEY_DATA; + if ((retval = krb5_db_put_principal(util_context, ent, &nentries))) { com_err(progname, retval, "while updating principal '%s' key data in the database", @@ -1422,6 +1425,8 @@ kdb5_purge_mkeys(int argc, char *argv[]) goto cleanup_return; } + master_entry.mask |= KADM5_KEY_DATA; + if ((retval = krb5_db_put_principal(util_context, &master_entry, &nentries))) { (void) krb5_db_fini(util_context); com_err(progname, retval, "while adding master key entry to the database"); diff --git a/src/lib/kdb/kdb5.c b/src/lib/kdb/kdb5.c index c7be706d8..ed85d89a6 100644 --- a/src/lib/kdb/kdb5.c +++ b/src/lib/kdb/kdb5.c @@ -2678,8 +2678,8 @@ krb5_dbe_delete_tl_data(krb5_context context, krb5_dbe_free_tl_data(context, free_tl_data); entry->n_tl_data--; } else { - tl_data = tl_data->tl_data_next; prev_tl_data = tl_data; + tl_data = tl_data->tl_data_next; } } diff --git a/src/plugins/kdb/ldap/libkdb_ldap/kdb_xdr.c b/src/plugins/kdb/ldap/libkdb_ldap/kdb_xdr.c index f8e1d4415..d4c6ac832 100644 --- a/src/plugins/kdb/ldap/libkdb_ldap/kdb_xdr.c +++ b/src/plugins/kdb/ldap/libkdb_ldap/kdb_xdr.c @@ -148,51 +148,6 @@ krb5_dbe_lookup_last_pwd_change(context, entry, stamp) return(0); } -#if 0 /************** Begin IFDEF'ed OUT *******************************/ -krb5_error_code -krb5_dbe_lookup_mkvno(krb5_context context, - krb5_db_entry *entry, - krb5_kvno *mkvno) -{ - krb5_tl_data tl_data; - krb5_error_code code; - krb5_int16 tmp; - - tl_data.tl_data_type = KRB5_TL_MKVNO; - - if ((code = krb5_dbe_lookup_tl_data(context, entry, &tl_data))) - return (code); - - /* XXX need to think about this */ - if (tl_data.tl_data_length != 2) { - *mkvno = 0; - return (0); - } - - /* XXX this needs to be the inverse of how this is encoded */ - krb5_kdb_decode_int16(tl_data.tl_data_contents, tmp); - - *mkvno = (krb5_kvno) tmp; - - return (0); -} - -krb5_error_code -krb5_dbe_update_mkvno(krb5_context context, - krb5_db_entry * entry, - krb5_kvno mkvno) -{ - krb5_tl_data tl_data; - krb5_octet buf[2]; /* this is the encoded size of an int16 */ - - tl_data.tl_data_type = KRB5_TL_MKVNO; - tl_data.tl_data_length = sizeof(buf); - krb5_kdb_encode_int16((krb5_int16) mkvno, buf); - tl_data.tl_data_contents = buf; - - return (krb5_dbe_update_tl_data(context, entry, &tl_data)); -} -#endif /**************** END IFDEF'ed OUT *******************************/ /* it seems odd that there's no function to remove a tl_data, but if I need one, I'll add one */ -- 2.26.2