From: Theodore Tso Date: Thu, 15 Sep 1994 01:58:33 +0000 (+0000) Subject: Fixed bug reported by Bill Sommerfeld where a missing byte-swap on a X-Git-Tag: krb5-1.0-beta4.3~121 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=30e653f1e51782f17817d95b05ee6c106dac3a37;p=krb5.git Fixed bug reported by Bill Sommerfeld where a missing byte-swap on a little-endian machine causes the delete operation fail. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@4235 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/keytab/file/ChangeLog b/src/lib/krb5/keytab/file/ChangeLog new file mode 100644 index 000000000..28a8435e4 --- /dev/null +++ b/src/lib/krb5/keytab/file/ChangeLog @@ -0,0 +1,6 @@ +Wed Sep 14 21:56:15 1994 Theodore Y. Ts'o (tytso@dcl) + + * ktf_util.c (krb5_ktfileint_delete_entry): Fixed bug reported by + Bill Sommerfeld where a missing byte-swap on a + little-endian machine causes the delete operation fail. + diff --git a/src/lib/krb5/keytab/file/ktf_util.c b/src/lib/krb5/keytab/file/ktf_util.c index d5d04083f..94d0daaad 100644 --- a/src/lib/krb5/keytab/file/ktf_util.c +++ b/src/lib/krb5/keytab/file/ktf_util.c @@ -205,16 +205,22 @@ krb5_int32 delete_point; if (!xfread(&size, sizeof(size), 1, KTFILEP(id))) { return KRB5_KT_END; } + if (KTVERSION(id) != KRB5_KT_VNO_1) + size = ntohl(size); + if (size > 0) { - size = -size; + krb5_int32 minus_size = -size; + if (KTVERSION(id) != KRB5_KT_VNO_1) + minus_size = htonl(minus_size); + if (fseek(KTFILEP(id), delete_point, SEEK_SET)) { return errno; } - if (!xfwrite(&size, sizeof(size), 1, KTFILEP(id))) { + + if (!xfwrite(&minus_size, sizeof(minus_size), 1, KTFILEP(id))) { return KRB5_KT_IOERR; } - size = -size; if (size < BUFSIZ) { len = size; } else {