From 5f2c7e282353c805b5f38ff7f320692faa0c05dd Mon Sep 17 00:00:00 2001 From: Richard Basch Date: Wed, 20 Mar 1996 01:02:02 +0000 Subject: [PATCH] * ktutil_funcs.c (ktutil_write_srvtab): use any type of des key in the keytab to create a v4 srvtab git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7669 dc483132-0cff-0310-8789-dd5450dbe970 --- src/kadmin/ktutil/ChangeLog | 5 +++ src/kadmin/ktutil/ktutil_funcs.c | 60 +++++++++++++++++--------------- 2 files changed, 37 insertions(+), 28 deletions(-) diff --git a/src/kadmin/ktutil/ChangeLog b/src/kadmin/ktutil/ChangeLog index 01a2505b1..d29e29b9a 100644 --- a/src/kadmin/ktutil/ChangeLog +++ b/src/kadmin/ktutil/ChangeLog @@ -1,3 +1,8 @@ +Tue Mar 19 19:41:31 1996 Richard Basch + + * ktutil_funcs.c (ktutil_write_srvtab): use any type of des key + in the keytab to create a v4 srvtab + Fri Jan 26 00:06:50 1996 Sam Hartman * ktutil.c (ktutil_list): Implement -e option to show enctypes. diff --git a/src/kadmin/ktutil/ktutil_funcs.c b/src/kadmin/ktutil/ktutil_funcs.c index bad66bdc7..5215fd815 100644 --- a/src/kadmin/ktutil/ktutil_funcs.c +++ b/src/kadmin/ktutil/ktutil_funcs.c @@ -319,36 +319,40 @@ krb5_error_code ktutil_write_srvtab(context, list, name) /* First do heinous stuff to prune the list. */ for (lp = list; lp; lp = lp->next) { - if (lp->entry->key.enctype == ENCTYPE_DES_CBC_CRC) {/* only DES keys! */ - for (lp1 = pruned; lp1; prev = lp1, lp1 = lp1->next) { - /* Hunt for the current principal in the pruned list */ - if (krb5_principal_compare(context, - lp->entry->principal, - lp1->entry->principal)) + if ((lp->entry->key.enctype != ENCTYPE_DES_CBC_CRC) && + (lp->entry->key.enctype != ENCTYPE_DES_CBC_MD5) && + (lp->entry->key.enctype != ENCTYPE_DES_CBC_MD4) && + (lp->entry->key.enctype != ENCTYPE_DES_CBC_RAW)) + continue; + + for (lp1 = pruned; lp1; prev = lp1, lp1 = lp1->next) { + /* Hunt for the current principal in the pruned list */ + if (krb5_principal_compare(context, + lp->entry->principal, + lp1->entry->principal)) break; - } - if (!lp1) { /* need to add entry to tail of pruned list */ - if (!pruned) { - pruned = (krb5_kt_list) malloc(sizeof (*pruned)); - if (!pruned) - return ENOMEM; - memset((char *) pruned, 0, sizeof(*pruned)); - lp1 = pruned; - } else { - prev->next - = (krb5_kt_list) malloc(sizeof (*pruned)); - if (!prev->next) { - retval = ENOMEM; - goto free_pruned; - } - memset((char *) prev->next, 0, sizeof(*pruned)); - lp1 = prev->next; - } - lp1->entry = lp->entry; - } else if (lp1->entry->vno < lp->entry->vno) - /* Check if lp->entry is newer kvno; if so, update */ - lp1->entry = lp->entry; } + if (!lp1) { /* need to add entry to tail of pruned list */ + if (!pruned) { + pruned = (krb5_kt_list) malloc(sizeof (*pruned)); + if (!pruned) + return ENOMEM; + memset((char *) pruned, 0, sizeof(*pruned)); + lp1 = pruned; + } else { + prev->next + = (krb5_kt_list) malloc(sizeof (*pruned)); + if (!prev->next) { + retval = ENOMEM; + goto free_pruned; + } + memset((char *) prev->next, 0, sizeof(*pruned)); + lp1 = prev->next; + } + lp1->entry = lp->entry; + } else if (lp1->entry->vno < lp->entry->vno) + /* Check if lp->entry is newer kvno; if so, update */ + lp1->entry = lp->entry; } fp = fopen(name, "w"); if (!fp) { -- 2.26.2