From 4619ba3427e1ceceef367370d6af0160320bbad6 Mon Sep 17 00:00:00 2001 From: Paul Park Date: Thu, 3 Aug 1995 16:03:43 +0000 Subject: [PATCH] Blind replacements to get kadmin.old to compile git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6388 dc483132-0cff-0310-8789-dd5450dbe970 --- src/kadmin.old/server/ChangeLog | 9 +++++++++ src/kadmin.old/server/adm_adm_func.c | 8 +++++--- src/kadmin.old/server/adm_fmt_inq.c | 7 +++++-- src/kadmin.old/server/adm_funcs.c | 30 +++++++++++++--------------- src/kadmin.old/server/adm_process.c | 16 +++++++++------ src/kadmin.old/server/adm_server.c | 8 +++++--- 6 files changed, 48 insertions(+), 30 deletions(-) diff --git a/src/kadmin.old/server/ChangeLog b/src/kadmin.old/server/ChangeLog index 1122d3037..9ae28605d 100644 --- a/src/kadmin.old/server/ChangeLog +++ b/src/kadmin.old/server/ChangeLog @@ -1,4 +1,13 @@ +Thu Aug 3 11:46:10 EDT 1995 Paul Park (pjpark@mit.edu) + * adm_{adm_func,fmt_inq,funcs,process,server}.c - In order to get + things to compile, replace "salt_type" with "key_data[0]. + key_data_type[1]", "kvno" with "key_data[0].key_data_kvno" + blindly. Also #ifdef out anything having to do with mod_name + mod_date and last_pwd_change. Change "principal" to "princ" + and remove or replace references to "key" and "alt_key". + + Mon Jul 17 15:11:40 EDT 1995 Paul Park (pjpark@mit.edu) * adm_server.c - Add NULL stash file argument to krb5_db_fetch_mkey(). diff --git a/src/kadmin.old/server/adm_adm_func.c b/src/kadmin.old/server/adm_adm_func.c index b65415279..5f9c860b1 100644 --- a/src/kadmin.old/server/adm_adm_func.c +++ b/src/kadmin.old/server/adm_adm_func.c @@ -107,7 +107,7 @@ adm_build_key (context, auth_context, new_passwd, oper_type, entry) outbuf.length = 3; if (oper_type == CHGOPER || oper_type == CH4OPER) { - outbuf.data[3] = entry.salt_type; + outbuf.data[3] = entry.key_data[0].key_data_type[1]; outbuf.length = 4; } @@ -222,7 +222,7 @@ adm_change_pwd(context, auth_context, prog, customer_name, salttype) retval = krb5_unparse_name(context, newprinc, &composite_name); - entry.salt_type = (krb5_int32) salttype; + entry.key_data[0].key_data_type[1] = (krb5_int16) salttype; if (retval = adm_enter_pwd_key(context, "adm_change_pwd", composite_name, @@ -583,7 +583,7 @@ adm_mod_old_key(context, auth_context, cmdname, customer_name) if (msg_data.data[3] == KMODVNO) { (void) memcpy(tempstr, (char *) msg_data.data + 4, msg_data.length - 4); - entry.kvno = atoi(tempstr); + entry.key_data[0].key_data_kvno = atoi(tempstr); } if (msg_data.data[3] == KMODATTR) { @@ -636,6 +636,7 @@ adm_mod_old_key(context, auth_context, cmdname, customer_name) } free(msg_data.data); +#ifdef notdef entry.mod_name = client_server_info.client; if (retval = krb5_timeofday(context, &entry.mod_date)) { com_err("adm_mod_old_key", retval, "while fetching date"); @@ -643,6 +644,7 @@ adm_mod_old_key(context, auth_context, cmdname, customer_name) krb5_db_free_principal(context, &entry, nprincs); return(5); /* Protocol Failure */ } +#endif /* notdef */ retval = krb5_db_put_principal(context, &entry, &one); if (retval) { diff --git a/src/kadmin.old/server/adm_fmt_inq.c b/src/kadmin.old/server/adm_fmt_inq.c index 40c79a1fe..074a75e43 100644 --- a/src/kadmin.old/server/adm_fmt_inq.c +++ b/src/kadmin.old/server/adm_fmt_inq.c @@ -162,12 +162,14 @@ adm_fmt_prt(context, entry, Principal_name, ret_data) sprintf(thisline, "Maximum Renewal Lifetime (MRL) = %d (seconds)\n", entry->max_renewable_life); strcat(my_data, thisline); - sprintf(thisline, "Principal Key Version (PKV) = %d\n", entry->kvno); + sprintf(thisline, "Principal Key Version (PKV) = %d\n", + entry->key_data[0].key_data_kvno); strcat(my_data, thisline); if (retval = adm_print_exp_time(context, my_data, &entry->expiration)) { free(my_data); return retval; } +#ifdef notdef mod_time = localtime((time_t *) &entry->mod_date); sprintf(thisline, "Last Modification Date (LMD): %02d%02d/%02d/%02d:%02d:%02d:%02d\n", @@ -179,11 +181,12 @@ adm_fmt_prt(context, entry, Principal_name, ret_data) mod_time->tm_min, mod_time->tm_sec); strcat(my_data, thisline); +#endif /* notdef */ if (retval = adm_print_attributes(my_data, entry->attributes)) { free(my_data); return retval; } - switch (entry->salt_type & 0xff) { + switch (entry->key_data[0].key_data_type[1] & 0xff) { case 0 : strcat(my_data, "Principal Salt Type (PST) = Version 5 Normal\n"); break; diff --git a/src/kadmin.old/server/adm_funcs.c b/src/kadmin.old/server/adm_funcs.c index 8b316cc85..6e65d4238 100644 --- a/src/kadmin.old/server/adm_funcs.c +++ b/src/kadmin.old/server/adm_funcs.c @@ -115,30 +115,35 @@ adm_modify_kdb(context, cmdname, newprinc, principal, key, alt_key, req_type, if (!req_type) { /* New entry - initialize */ memset((char *) entry, 0, sizeof(krb5_db_entry)); - retval = krb5_copy_principal(context, principal, &entry->principal); + retval = krb5_copy_principal(context, principal, &entry->princ); if (retval) return retval; - entry->kvno = KDB5_VERSION_NUM; entry->max_life = master_entry.max_life; entry->max_renewable_life = master_entry.max_renewable_life; - entry->mkvno = master_entry.mkvno; entry->expiration = master_entry.expiration; +#ifdef notdef + entry->kvno = KDB5_VERSION_NUM; + entry->mkvno = master_entry.mkvno; retval = krb5_copy_principal(context, master_princ, &entry->mod_name); if (retval) { krb5_free_principal(context, entry->principal); entry->principal = 0; return retval; } +#endif /* notdef */ } else { /* Modify existing entry */ - entry->kvno++; #ifdef SANDIA entry->attributes &= ~KRB5_KDB_REQUIRES_PWCHANGE; #endif +#ifdef notdef + entry->kvno++; retval = krb5_copy_principal(context, principal, &entry->mod_name); if (retval) return retval; +#endif /* notdef */ } +#ifdef notdef if (key && key->length) { retval = krb5_kdb_encrypt_key(context, &master_encblock, key, @@ -235,21 +240,10 @@ adm_modify_kdb(context, cmdname, newprinc, principal, key, alt_key, req_type, return(5); } } +#endif /* notdef */ retval = krb5_db_put_principal(context, entry, &one); - if (entry->key.contents) { - memset((char *) entry->key.contents, 0, entry->key.length); - krb5_xfree(entry->key.contents); - entry->key.contents = 0; - } - - if (entry->alt_key.contents) { - memset((char *) entry->alt_key.contents, 0, entry->alt_key.length); - krb5_xfree(entry->alt_key.contents); - entry->alt_key.contents = 0; - } - if (retval) { com_err("adm_modify_kdb", retval, "while storing entry for '%s'\n", newprinc); @@ -439,11 +433,13 @@ adm5_change(context, auth_context, prog, newprinc) return retval; } +#ifdef notdef if (entry.salt_type == KRB5_KDB_SALTTYPE_V4) { entry.salt_type = KRB5_KDB_SALTTYPE_NORMAL; entry.alt_salt_type = KRB5_KDB_SALTTYPE_V4; com_err("adm5_change", 0, "Converting v4user to v5user"); } +#endif /* notdef */ retval = adm_enter_pwd_key(context, "adm5_change", composite_name, @@ -515,8 +511,10 @@ adm_enter_rnd_pwd_key(context, cmdname, change_princ, req_type, entry) struct saltblock salt; char *principal_name; +#ifdef notdef salt.salttype = salttype; entry->salt_type = salttype; +#endif /* notdef */ if (retval = krb5_init_random_key(context, &master_encblock, &master_keyblock, diff --git a/src/kadmin.old/server/adm_process.c b/src/kadmin.old/server/adm_process.c index 725f6ecc2..eb5af3e58 100644 --- a/src/kadmin.old/server/adm_process.c +++ b/src/kadmin.old/server/adm_process.c @@ -48,6 +48,7 @@ cpw_keyproc(context, keyblock) krb5_keyblock *realkey; krb5_boolean more; int nprincs = 1; + krb5_keysalt salt; if (*keyblock == NULL) { if (retval = krb5_parse_name(context, @@ -78,10 +79,11 @@ cpw_keyproc(context, keyblock) } /* Extract the real kadmin/ keyblock */ - if (retval = krb5_kdb_decrypt_key(context, + if (retval = krb5_dbekd_decrypt_key_data(context, &master_encblock, - &cpw_entry.key, - realkey)) { + &cpw_entry.key_data[0], + realkey, + &salt)) { krb5_db_free_principal(context, &cpw_entry, nprincs); free(realkey); syslog(LOG_ERR, @@ -127,6 +129,7 @@ process_client(context, prog) krb5_data outbuf; krb5_data inbuf, msg_data; extern int errno; + krb5_keysalt salt; krb5_timestamp adm_time; @@ -190,10 +193,11 @@ process_client(context, prog) } /* Extract the real kadmin/ keyblock */ - if (retval = krb5_kdb_decrypt_key(context, + if (retval = krb5_dbekd_decrypt_key_data(context, &master_encblock, - &server_entry.key, - cpw_keyblock)) { + &server_entry.key_data[0], + cpw_keyblock, + &salt)) { krb5_db_free_principal(context, &server_entry, number_of_entries); free(cpw_keyblock); syslog(LOG_ERR, diff --git a/src/kadmin.old/server/adm_server.c b/src/kadmin.old/server/adm_server.c index 211580017..a8cb92f4a 100644 --- a/src/kadmin.old/server/adm_server.c +++ b/src/kadmin.old/server/adm_server.c @@ -276,6 +276,7 @@ init_db(context, dbname, masterkeyname, masterkeyblock) krb5_boolean more; int number_of_entries; char tgs_name[255]; + krb5_keysalt salt; /* set db name if appropriate */ if (dbname && (retval = krb5_db_set_name(context, dbname))) @@ -357,8 +358,9 @@ init_db(context, dbname, masterkeyname, masterkeyblock) convert server.key into a real key (it may be encrypted in the database) */ - if (retval = krb5_kdb_decrypt_key(context,&master_encblock, - &server_entry.key,&tgs_key)) { + if (retval = krb5_dbekd_decrypt_key_data(context,&master_encblock, + &server_entry.key_data[0],&tgs_key, + &salt)) { krb5_db_free_principal(context, &server_entry, number_of_entries); (void) krb5_finish_key(context, &master_encblock); memset((char *)&master_encblock, 0, sizeof(master_encblock)); @@ -366,7 +368,7 @@ init_db(context, dbname, masterkeyname, masterkeyblock) return(retval); } - tgs_kvno = server_entry.kvno; + tgs_kvno = server_entry.key_data[0].key_data_kvno; krb5_db_free_principal(context, &server_entry, number_of_entries); return(0); } -- 2.26.2