]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
Fix problems with 64-bit big-endian machines
authorkwc@citi.umich.edu <kwc@citi.umich.edu>
Mon, 3 Jul 2006 22:34:05 +0000 (18:34 -0400)
committerNeil Brown <neilb@suse.de>
Tue, 4 Jul 2006 00:27:15 +0000 (10:27 +1000)
Signed-off-by: Kevin Coffman <kwc@citi.umich.edu>
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
utils/gssd/write_bytes.h

index 37b8b8e12b25ea52368622ad6f4bf948f7219341..c0b494b4a102a42cb7e492cb8d79efb9696a23ab 100644 (file)
@@ -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",
index f166148fd3ff631ffb03b325e0b46459752f9990..8021cd823c9cc7a7340b5143ab3574fd69adae63 100644 (file)
@@ -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;