From 119c3e9aafe84c0f7c2846c46ad5e6f5eeece0da Mon Sep 17 00:00:00 2001 From: "kwc@citi.umich.edu" Date: Mon, 3 Jul 2006 18:34:05 -0400 Subject: [PATCH] Fix problems with 64-bit big-endian machines Signed-off-by: Kevin Coffman Correct the definition of mech_used in the gss context to use gss_OID_desc. This fixes problems on 64-bit machines when referencing the OID. Also updates write_buffer function to use u_int rather than size_t when doing calculations. --- utils/gssd/context_mit.c | 6 +++--- utils/gssd/write_bytes.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/utils/gssd/context_mit.c b/utils/gssd/context_mit.c index 37b8b8e..c0b494b 100644 --- a/utils/gssd/context_mit.c +++ b/utils/gssd/context_mit.c @@ -86,7 +86,7 @@ typedef struct _krb5_gss_ctx_id_rec { uint64_t seq_recv; /* gssint_uint64 */ void *seqstate; krb5_auth_context auth_context; - gss_buffer_desc *mech_used; /* gss_OID_desc */ + gss_OID_desc *mech_used; /* gss_OID_desc */ /* Protocol spec revision 0 => RFC 1964 with 3DES and RC4 enhancements 1 => draft-ietf-krb-wg-gssapi-cfx-01 @@ -123,7 +123,7 @@ typedef struct _krb5_gss_ctx_id_rec { int established; int big_endian; krb5_auth_context auth_context; - gss_buffer_desc *mech_used; + gss_OID_desc *mech_used; int nctypes; krb5_cksumtype *ctypes; } krb5_gss_ctx_id_rec, *krb5_gss_ctx_id_t; @@ -343,7 +343,7 @@ serialize_krb5_ctx(gss_ctx_id_t ctx, gss_buffer_desc *buf) if (WRITE_BYTES(&p, end, kctx->endtime)) goto out_err; word_seq_send = kctx->seq_send; if (WRITE_BYTES(&p, end, word_seq_send)) goto out_err; - if (write_buffer(&p, end, kctx->mech_used)) goto out_err; + if (write_oid(&p, end, kctx->mech_used)) goto out_err; printerr(2, "serialize_krb5_ctx: serializing keys with " "enctype %d and length %d\n", diff --git a/utils/gssd/write_bytes.h b/utils/gssd/write_bytes.h index f166148..8021cd8 100644 --- a/utils/gssd/write_bytes.h +++ b/utils/gssd/write_bytes.h @@ -56,7 +56,7 @@ write_buffer(char **p, char *end, gss_buffer_desc *arg) int len = (int)arg->length; /* make an int out of size_t */ if (WRITE_BYTES(p, end, len)) return -1; - if (*p + arg->length > end) + if (*p + len > end) return -1; memcpy(*p, arg->value, len); *p += len; -- 2.39.5