From edfaf185ccf72b3c9c80b40eb4bc7d60f7cab0ef Mon Sep 17 00:00:00 2001 From: John Kohl Date: Thu, 26 Apr 1990 17:17:35 +0000 Subject: [PATCH] finish implementation git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@592 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/keytab/file/ktf_get_en.c | 39 ++++++++++++++++++++------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/src/lib/krb5/keytab/file/ktf_get_en.c b/src/lib/krb5/keytab/file/ktf_get_en.c index 069bc67aa..a4e919225 100644 --- a/src/lib/krb5/keytab/file/ktf_get_en.c +++ b/src/lib/krb5/keytab/file/ktf_get_en.c @@ -19,17 +19,22 @@ static char rcsid_krb5_ktfile_get_entry_c[] = #include #include +#include +#include #include "ktfile.h" krb5_error_code -krb5_ktfile_get_entry(id, principal, kvno, entry) - krb5_keytab id; - krb5_principal principal; - krb5_kvno kvno; - krb5_keytab_entry *entry; +krb5_ktfile_get_entry(DECLARG(krb5_keytab, id), + DECLARG(krb5_principal, principal), + DECLARG(krb5_kvno, kvno), + DECLARG(krb5_keytab_entry *, entry)) +OLDDECLARG(krb5_keytab, id) +OLDDECLARG(krb5_principal, principal) +OLDDECLARG(krb5_kvno, kvno) +OLDDECLARG(krb5_keytab_entry *, entry) { - krb5_keytab_entry cur_entry; + krb5_keytab_entry *cur_entry; krb5_error_code kerror = 0; /* XXX */ bzero((char *)&cur_entry, sizeof(krb5_keytab_entry)); @@ -43,8 +48,24 @@ krb5_ktfile_get_entry(id, principal, kvno, entry) * is exited with a break statement. */ while (TRUE) { - if (kerror = krb5_ktfileint_read_entry(id, &entry)) + if (kerror = krb5_ktfileint_read_entry(id, &cur_entry)) break; - if (((kvno == IGNORE_VNO) || (kvno == entry.kvno)) && - (principal XXXXX here XXXXX + if (((kvno == IGNORE_VNO) || (kvno == cur_entry->vno)) && + krb5_principal_compare(principal, cur_entry->principal)) { + /* found a match */ + break; + } + krb5_kt_free_entry(cur_entry); + } + if (kerror && kerror != KRB5_KT_END) { + (void) krb5_ktfileint_close(id); + return kerror; + } + if (!(kerror = krb5_ktfileint_close(id))) { + *entry = *cur_entry; + xfree(cur_entry); + } else + krb5_kt_free_entry(cur_entry); + return kerror; +} -- 2.26.2