From: Chris Provenzano Date: Wed, 25 Jan 1995 22:28:14 +0000 (+0000) Subject: * Removed all narrow types and references to wide.h and narrow.h X-Git-Tag: krb5-1.0-beta5~819 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6f1aa2f7f690666523c472109560593bf6e5d036;p=krb5.git * Removed all narrow types and references to wide.h and narrow.h * ktf_util.c : Use a constant size for file data not subfield size from krb5_keytab_entry git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@4836 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/keytab/file/ChangeLog b/src/lib/krb5/keytab/file/ChangeLog index dd484148f..1bf546cb1 100644 --- a/src/lib/krb5/keytab/file/ChangeLog +++ b/src/lib/krb5/keytab/file/ChangeLog @@ -1,3 +1,9 @@ +Wed Jan 25 16:54:40 1995 Chris Provenzano (proven@mit.edu) + + * Removed all narrow types and references to wide.h and narrow.h + * ktf_util.c : Use a constant size for file data not subfield + size from krb5_keytab_entry + Fri Nov 18 15:34:35 1994 Theodore Y. Ts'o (tytso@dcl) * ktf_util.c (krb5_ktfileint_internal_read_entry): Add magic diff --git a/src/lib/krb5/keytab/file/ktf_util.c b/src/lib/krb5/keytab/file/ktf_util.c index dc115df41..0ea747b65 100644 --- a/src/lib/krb5/keytab/file/ktf_util.c +++ b/src/lib/krb5/keytab/file/ktf_util.c @@ -61,14 +61,15 @@ * For each component, sizeof(krb5_int16) bytes for the number of bytes * in the component, followed by the component. * sizeof(krb5_int32) for the principal type (for KEYTAB V2 and higher) - * sizeof(krb5_timestamp) bytes for the timestamp - * sizeof(krb5_kvno) bytes for the key version number - * sizeof(krb5_keytype) bytes for the keytype + * sizeof(krb5_int32) bytes for the timestamp + * sizeof(krb5_octet) bytes for the key version number + * sizeof(krb5_int16) bytes for the keytype * sizeof(krb5_int32) bytes for the key length, followed by the key * */ + #include #include #include @@ -254,7 +255,9 @@ krb5_keytab id; krb5_keytab_entry *ret_entry; krb5_int32 *delete_point; { + krb5_octet vno; krb5_int16 count; + krb5_int16 keytype; krb5_int16 princ_size; register int i; krb5_int32 size; @@ -391,17 +394,19 @@ krb5_int32 *delete_point; ret_entry->timestamp = ntohl(ret_entry->timestamp); /* read in the version number */ - if (!xfread(&ret_entry->vno, sizeof(ret_entry->vno), 1, KTFILEP(id))) { + if (!xfread(&vno, sizeof(vno), 1, KTFILEP(id))) { error = KRB5_KT_END; goto fail; } + ret_entry->vno = (krb5_kvno)vno; /* key type */ - if (!xfread(&ret_entry->key.keytype, sizeof(ret_entry->key.keytype), 1, - KTFILEP(id))) { + if (!xfread(&keytype, sizeof(keytype), 1, KTFILEP(id))) { error = KRB5_KT_END; goto fail; } + ret_entry->key.keytype = (krb5_keytype)keytype; + if (KTVERSION(id) != KRB5_KT_VNO_1) ret_entry->key.keytype = ntohs(ret_entry->key.keytype); @@ -468,6 +473,7 @@ krb5_ktfileint_write_entry(context, id, entry) krb5_keytab id; krb5_keytab_entry *entry; { + krb5_octet vno; krb5_data *princ; krb5_int16 count, size, keytype; krb5_error_code retval = 0; @@ -555,7 +561,8 @@ krb5_keytab_entry *entry; } /* key version number */ - if (!xfwrite(&entry->vno, sizeof(entry->vno), 1, KTFILEP(id))) { + vno = (krb5_octet)entry->vno; + if (!xfwrite(&vno, sizeof(vno), 1, KTFILEP(id))) { goto abend; } /* key type */ @@ -628,8 +635,8 @@ krb5_int32 *size_needed; total_size += sizeof(entry->principal->type); total_size += sizeof(entry->timestamp); - total_size += sizeof(entry->vno); - total_size += sizeof(entry->key.keytype); + total_size += sizeof(krb5_octet); + total_size += sizeof(krb5_int16); total_size += sizeof(size) + entry->key.length; *size_needed = total_size; diff --git a/src/lib/krb5/keytab/file/ktfile.h b/src/lib/krb5/keytab/file/ktfile.h index 2a3f3a622..1a4320fae 100644 --- a/src/lib/krb5/keytab/file/ktfile.h +++ b/src/lib/krb5/keytab/file/ktfile.h @@ -61,9 +61,6 @@ typedef struct _krb5_ktfile_data { extern struct _krb5_kt_ops krb5_ktf_ops; extern struct _krb5_kt_ops krb5_ktf_writable_ops; -/* widen prototypes, if needed */ -#include - krb5_error_code krb5_ktfile_resolve PROTOTYPE((krb5_context, const char *, @@ -162,7 +159,5 @@ krb5_error_code krb5_ktfileint_find_slot krb5_int32 *, krb5_int32 *)); -/* and back to normal... */ -#include #endif /* KRB5_KTFILE__ */