From 9a079c2554aaed0c78c96f3a47a6f46c5dd3df11 Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Tue, 30 Apr 1996 18:48:49 +0000 Subject: [PATCH] For windows, mask off low 16 bits because Gradient DCE does things wrong. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7866 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/ccache/file/ChangeLog | 7 +++++++ src/lib/krb5/ccache/file/fcc_read.c | 16 ++++++++++++++++ src/lib/krb5/ccache/stdio/ChangeLog | 7 +++++++ src/lib/krb5/ccache/stdio/scc_read.c | 28 +++++++++++++++++++++++++++- 4 files changed, 57 insertions(+), 1 deletion(-) diff --git a/src/lib/krb5/ccache/file/ChangeLog b/src/lib/krb5/ccache/file/ChangeLog index 9b6010664..17559ecf2 100644 --- a/src/lib/krb5/ccache/file/ChangeLog +++ b/src/lib/krb5/ccache/file/ChangeLog @@ -1,3 +1,10 @@ +Wed Feb 14 10:44:27 1996 + + * fcc_read.c (krb5_fcc_read_keyblock, krb5_fcc_read_data, + krb5_fcc_read_authdatum, krb5_fcc_read_addr): For windows, + mask off low 16 bits because Gradient DCE does things + wrong. + Wed Mar 20 22:48:51 1996 Theodore Y. Ts'o * fcc-proto.h (krb5_fcc_skip_header): Added prototype (fix Windows diff --git a/src/lib/krb5/ccache/file/fcc_read.c b/src/lib/krb5/ccache/file/fcc_read.c index aa2cba8ea..c4ff13d20 100644 --- a/src/lib/krb5/ccache/file/fcc_read.c +++ b/src/lib/krb5/ccache/file/fcc_read.c @@ -214,8 +214,12 @@ krb5_fcc_read_keyblock(context, id, keyblock) kret = krb5_fcc_read_int32(context, id, &int32); CHECK(kret); +#ifdef _WINDOWS + int32 &= VALID_INT_BITS; /* Gradient does not write correctly */ +#else if ((int32 & VALID_INT_BITS) != int32) /* Overflow size_t??? */ return KRB5_CC_NOMEM; +#endif keyblock->length = (int) int32; if ( keyblock->length == 0 ) return KRB5_OK; @@ -249,8 +253,12 @@ krb5_fcc_read_data(context, id, data) kret = krb5_fcc_read_int32(context, id, &len); CHECK(kret); +#ifdef _WINDOWS + len &= VALID_INT_BITS; +#else if ((len & VALID_INT_BITS) != len) return KRB5_CC_NOMEM; +#endif data->length = (int) len; if (data->length == 0) { @@ -292,8 +300,12 @@ krb5_fcc_read_addr(context, id, addr) kret = krb5_fcc_read_int32(context, id, &int32); CHECK(kret); +#ifdef _WINDOWS + int32 &= VALID_INT_BITS; /* Gradient DCE does this wrong */ +#else if ((int32 & VALID_INT_BITS) != int32) /* Overflow int??? */ return KRB5_CC_NOMEM; +#endif addr->length = (int) int32; if (addr->length == 0) @@ -471,8 +483,12 @@ krb5_fcc_read_authdatum(context, id, a) a->ad_type = (krb5_authdatatype)ui2; kret = krb5_fcc_read_int32(context, id, &int32); CHECK(kret); +#ifdef _WINDOWS + int32 &= VALID_INT_BITS; +#else if ((int32 & VALID_INT_BITS) != int32) /* Overflow int??? */ return KRB5_CC_NOMEM; +#endif a->length = (int) int32; if (a->length == 0 ) diff --git a/src/lib/krb5/ccache/stdio/ChangeLog b/src/lib/krb5/ccache/stdio/ChangeLog index 4eb60f7d5..bb5664f39 100644 --- a/src/lib/krb5/ccache/stdio/ChangeLog +++ b/src/lib/krb5/ccache/stdio/ChangeLog @@ -1,3 +1,10 @@ +Wed Feb 14 10:44:27 1996 + + * scc_read.c (krb5_scc_read_keyblock, krb5_scc_read_data, + krb5_scc_read_authdatum, krb5_scc_read_addr): For windows, + mask off low 16 bits because Gradient DCE does things + wrong. + Wed Mar 20 22:50:05 1996 Theodore Y. Ts'o * scc-proto.h (krb5_scc_skip_header): Added prototype (to fix lint diff --git a/src/lib/krb5/ccache/stdio/scc_read.c b/src/lib/krb5/ccache/stdio/scc_read.c index 6c50794cf..f1bec6f34 100644 --- a/src/lib/krb5/ccache/stdio/scc_read.c +++ b/src/lib/krb5/ccache/stdio/scc_read.c @@ -208,6 +208,12 @@ krb5_scc_read_keyblock(context, id, keyblock) kret = krb5_scc_read_int32(context, id, &int32); CHECK(kret); +#ifdef _WINDOWS + int32 &= VALID_INT_BITS; /* Gradient does not write correctly */ +#else + if ((int32 & VALID_INT_BITS) != int32) /* Overflow size_t??? */ + return KRB5_CC_NOMEM; +#endif keyblock->length = int32; if ( keyblock->length == 0 ) return KRB5_OK; @@ -234,12 +240,20 @@ krb5_scc_read_data(context, id, data) krb5_data *data; { krb5_error_code kret; + krb5_int32 len; data->magic = KV5M_DATA; data->data = 0; - kret = krb5_scc_read_int32(context, id, &data->length); + kret = krb5_scc_read_int32(context, id, &len); CHECK(kret); +#ifdef _WINDOWS + len &= VALID_INT_BITS; +#else + if ((len & VALID_INT_BITS) != len) + return KRB5_CC_NOMEM; +#endif + data->length = (int) len; if (data->length == 0) { data->data = 0; @@ -280,6 +294,12 @@ krb5_scc_read_addr(context, id, addr) kret = krb5_scc_read_int32(context, id, &int32); CHECK(kret); +#ifdef _WINDOWS + int32 &= VALID_INT_BITS; /* Gradient DCE does this wrong */ +#else + if ((int32 & VALID_INT_BITS) != int32) /* Overflow int??? */ + return KRB5_CC_NOMEM; +#endif addr->length = int32; if (addr->length == 0) @@ -449,6 +469,12 @@ krb5_scc_read_authdatum(context, id, a) a->ad_type = (krb5_authdatatype)ui2; kret = krb5_scc_read_int32(context, id, &int32); CHECK(kret); +#ifdef _WINDOWS + int32 &= VALID_INT_BITS; +#else + if ((int32 & VALID_INT_BITS) != int32) /* Overflow int??? */ + return KRB5_CC_NOMEM; +#endif a->length = int32; if (a->length == 0 ) -- 2.26.2