From c2238c82daf51b1f34d55f06ad0c0a6c064bfdbc Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Wed, 18 Dec 2002 06:05:38 +0000 Subject: [PATCH] Fix some 64-bit problems git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15052 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/rpc/ChangeLog | 7 +++++++ src/lib/rpc/auth_gssapi_misc.c | 24 ++++++++++++++++-------- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/lib/rpc/ChangeLog b/src/lib/rpc/ChangeLog index 2a33ed95b..2a8bfe579 100644 --- a/src/lib/rpc/ChangeLog +++ b/src/lib/rpc/ChangeLog @@ -1,3 +1,10 @@ +2002-12-18 Ken Raeburn + + * auth_gssapi_misc.c (xdr_gss_buf, auth_gssapi_wrap_data, + auth_gssapi_unwrap_data): Use temporary variables rather than + pointer casts when dealing with integral types of different + sizes. + 2002-12-12 Tom Yu * Makefile.in (all-prerecurse): Change double colons to single diff --git a/src/lib/rpc/auth_gssapi_misc.c b/src/lib/rpc/auth_gssapi_misc.c index 00420aa6f..ab9b0bcbc 100644 --- a/src/lib/rpc/auth_gssapi_misc.c +++ b/src/lib/rpc/auth_gssapi_misc.c @@ -39,9 +39,14 @@ bool_t xdr_gss_buf(xdrs, buf) * to know the maximum length. -1 effectively disables this * braindamage. */ - return xdr_bytes(xdrs, (char **) &buf->value, (unsigned int *) &buf->length, - (xdrs->x_op == XDR_DECODE && buf->value == NULL) - ? (unsigned int) -1 : (unsigned int) buf->length); + bool_t result; + /* Fix type mismatches between APIs. */ + unsigned int length = buf->length; + result = xdr_bytes(xdrs, (char **) &buf->value, &length, + (xdrs->x_op == XDR_DECODE && buf->value == NULL) + ? (unsigned int) -1 : (unsigned int) buf->length); + buf->length = length; + return result; } bool_t xdr_authgssapi_creds(xdrs, creds) @@ -192,6 +197,7 @@ bool_t auth_gssapi_wrap_data(major, minor, context, seq_num, out_xdrs, gss_buffer_desc in_buf, out_buf; XDR temp_xdrs; int conf_state; + unsigned int length; PRINTF(("gssapi_wrap_data: starting\n")); @@ -230,8 +236,9 @@ bool_t auth_gssapi_wrap_data(major, minor, context, seq_num, out_xdrs, (int) in_buf.length, (int) out_buf.length)); /* write the token */ + length = out_buf.length; if (! xdr_bytes(out_xdrs, (char **) &out_buf.value, - (unsigned int *) &out_buf.length, + (unsigned int *) &length, out_buf.length)) { PRINTF(("gssapi_wrap_data: serializing encrypted data failed\n")); XDR_DESTROY(&temp_xdrs); @@ -258,6 +265,7 @@ bool_t auth_gssapi_unwrap_data(major, minor, context, seq_num, XDR temp_xdrs; rpc_u_int32 verf_seq_num; int conf, qop; + unsigned int length; PRINTF(("gssapi_unwrap_data: starting\n")); @@ -266,15 +274,15 @@ bool_t auth_gssapi_unwrap_data(major, minor, context, seq_num, in_buf.value = NULL; out_buf.value = NULL; - if (! xdr_bytes(in_xdrs, (char **) &in_buf.value, - (unsigned int *) &in_buf.length, (unsigned int) -1)) { + if (! xdr_bytes(in_xdrs, (char **) &in_buf.value, + &length, (unsigned int) -1)) { PRINTF(("gssapi_unwrap_data: deserializing encrypted data failed\n")); temp_xdrs.x_op = XDR_FREE; - (void)xdr_bytes(&temp_xdrs, (char **) &in_buf.value, - (unsigned int *) &in_buf.length, + (void)xdr_bytes(&temp_xdrs, (char **) &in_buf.value, &length, (unsigned int) -1); return FALSE; } + in_buf.length = length; *major = gss_unseal(minor, context, &in_buf, &out_buf, &conf, &qop); -- 2.26.2