]> err.no Git - linux-2.6/blobdiff - net/sunrpc/auth_gss/gss_generic_token.c
Merge branch 'linus' into x86/paravirt-spinlocks
[linux-2.6] / net / sunrpc / auth_gss / gss_generic_token.c
index 826df44e7fca15dfdb2f640e5dfc84f872ddb2ce..d83b881685fe52d5c5e22e53c6c394f4a0fc4245 100644 (file)
@@ -11,7 +11,7 @@
 
 /*
  * Copyright 1993 by OpenVision Technologies, Inc.
- * 
+ *
  * Permission to use, copy, modify, distribute, and sell this software
  * and its documentation for any purpose is hereby granted without fee,
  * provided that the above copyright notice appears in all copies and
@@ -21,7 +21,7 @@
  * without specific, written prior permission. OpenVision makes no
  * representations about the suitability of this software for any
  * purpose.  It is provided "as is" without express or implied warranty.
- * 
+ *
  * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR
@@ -148,7 +148,7 @@ int
 g_token_size(struct xdr_netobj *mech, unsigned int body_size)
 {
        /* set body_size to sequence contents size */
-       body_size += 4 + (int) mech->len;         /* NEED overflow check */
+       body_size += 2 + (int) mech->len;         /* NEED overflow check */
        return(1 + der_length_size(body_size) + body_size);
 }
 
@@ -161,7 +161,7 @@ void
 g_make_token_header(struct xdr_netobj *mech, int body_size, unsigned char **buf)
 {
        *(*buf)++ = 0x60;
-       der_write_length(buf, 4 + mech->len + body_size);
+       der_write_length(buf, 2 + mech->len + body_size);
        *(*buf)++ = 0x06;
        *(*buf)++ = (unsigned char) mech->len;
        TWRITE_STR(*buf, mech->data, ((int) mech->len));
@@ -201,7 +201,7 @@ g_verify_token_header(struct xdr_netobj *mech, int *body_size,
                return(G_BAD_TOK_HEADER);
        if (*buf++ != 0x06)
                return(G_BAD_TOK_HEADER);
+
        if ((toksize-=1) < 0)
                return(G_BAD_TOK_HEADER);
        toid.len = *buf++;
@@ -211,9 +211,9 @@ g_verify_token_header(struct xdr_netobj *mech, int *body_size,
        toid.data = buf;
        buf+=toid.len;
 
-       if (! g_OID_equal(&toid, mech)) 
+       if (! g_OID_equal(&toid, mech))
                ret = G_WRONG_MECH;
+
    /* G_WRONG_MECH is not returned immediately because it's more important
       to return G_BAD_TOK_HEADER if the token header is in fact bad */