From c18a1b18c323ddeaaa30074e6bb9bf81fe983285 Mon Sep 17 00:00:00 2001 From: Keith Vetter Date: Thu, 2 Mar 1995 00:39:52 +0000 Subject: [PATCH] Fixed some 16 vs. 32 bit conversion problems for the PC git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5053 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/keytab/ChangeLog | 4 ++++ src/lib/krb5/keytab/Makefile.in | 6 +++--- src/lib/krb5/keytab/file/ChangeLog | 4 ++++ src/lib/krb5/keytab/file/ktf_util.c | 22 ++++++++++++---------- 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/lib/krb5/keytab/ChangeLog b/src/lib/krb5/keytab/ChangeLog index aa393c882..62873e7c7 100644 --- a/src/lib/krb5/keytab/ChangeLog +++ b/src/lib/krb5/keytab/ChangeLog @@ -1,3 +1,7 @@ +Wed Mar 3 16:30:00 1995 Keith Vetter (keithv@fusion.com) + + * Makefile.in: changed LIB to LIBCMD for the PC + Tue Feb 28 00:59:22 1995 John Gilmore (gnu at toad.com) * *.c: Avoid includes. diff --git a/src/lib/krb5/keytab/Makefile.in b/src/lib/krb5/keytab/Makefile.in index 87807387d..a0f49fc43 100644 --- a/src/lib/krb5/keytab/Makefile.in +++ b/src/lib/krb5/keytab/Makefile.in @@ -27,8 +27,8 @@ all-unix:: all-windows:: cd file - @echo Making in ..\file - -$(MAKE) -$(MFLAGS) LIB=$(LIB) + @echo Making in .\file + -$(MAKE) -$(MFLAGS) LIBCMD=$(LIBCMD) cd .. clean:: clean-$(WHAT) @@ -37,6 +37,6 @@ clean-unix:: clean-windows:: cd file - @echo Making clean in ..\file + @echo Making clean in .\file -$(MAKE) -$(MFLAGS) clean cd .. diff --git a/src/lib/krb5/keytab/file/ChangeLog b/src/lib/krb5/keytab/file/ChangeLog index b0090abd4..218e4f50c 100644 --- a/src/lib/krb5/keytab/file/ChangeLog +++ b/src/lib/krb5/keytab/file/ChangeLog @@ -1,3 +1,7 @@ +Wed Mar 1 16:30:00 1995 Keith Vetter (keithv@fusion.com) + + * ktf_util.c: fixed up some 16 vs 32 bit conversions. + Tue Feb 28 01:01:15 1995 John Gilmore (gnu at toad.com) * *.c: Avoid includes. diff --git a/src/lib/krb5/keytab/file/ktf_util.c b/src/lib/krb5/keytab/file/ktf_util.c index 84466efc4..c6b17c0f2 100644 --- a/src/lib/krb5/keytab/file/ktf_util.c +++ b/src/lib/krb5/keytab/file/ktf_util.c @@ -67,6 +67,8 @@ * sizeof(krb5_int32) bytes for the key length, followed by the key */ +#define NEED_WINSOCK_H +#include "krb5.h" #include "k5-int.h" #include @@ -333,7 +335,7 @@ krb5_int32 *delete_point; error = ENOMEM; goto fail; } - if (fread(tmpdata, 1, princ_size, KTFILEP(id)) != princ_size) { + if (fread(tmpdata, 1, princ_size, KTFILEP(id)) != (size_t) princ_size) { free(tmpdata); error = KRB5_KT_END; goto fail; @@ -495,9 +497,9 @@ krb5_keytab_entry *entry; } if (KTVERSION(id) == KRB5_KT_VNO_1) { - count = entry->principal->length + 1; + count = (krb5_int16) entry->principal->length + 1; } else { - count = htons(entry->principal->length); + count = htons((u_short) entry->principal->length); } if (!xfwrite(&count, sizeof(count), 1, KTFILEP(id))) { @@ -516,7 +518,7 @@ krb5_keytab_entry *entry; goto abend; } - count = entry->principal->length; + count = (krb5_int16) entry->principal->length; for (i = 0; i < count; i++) { princ = krb5_princ_component(context, entry->principal, i); size = princ->length; @@ -613,25 +615,25 @@ krb5_ktfileint_size_entry(context, entry, size_needed) krb5_keytab_entry *entry; krb5_int32 *size_needed; { - krb5_int16 count, size; + krb5_int16 count; krb5_int32 total_size, i; krb5_error_code retval = 0; - count = entry->principal->length; - + count = (krb5_int16) entry->principal->length; + total_size = sizeof(count); - total_size += krb5_princ_realm(context, entry->principal)->length + (sizeof(size)); + total_size += krb5_princ_realm(context, entry->principal)->length + (sizeof(krb5_int16)); for (i = 0; i < count; i++) { total_size += krb5_princ_component(context, entry->principal,i)->length - + (sizeof(size)); + + (sizeof(krb5_int16)); } total_size += sizeof(entry->principal->type); total_size += sizeof(entry->timestamp); total_size += sizeof(krb5_octet); total_size += sizeof(krb5_int16); - total_size += sizeof(size) + entry->key.length; + total_size += sizeof(krb5_int16) + entry->key.length; *size_needed = total_size; return retval; -- 2.26.2