]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
rpcgss: krb5: miscellaneous cleanup
authorJ. Bruce Fields <bfields@fieldses.org>
Tue, 5 Dec 2006 01:22:42 +0000 (20:22 -0500)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Wed, 6 Dec 2006 15:46:48 +0000 (10:46 -0500)
Miscellaneous cosmetic fixes.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
net/sunrpc/auth_gss/gss_krb5_seal.c
net/sunrpc/auth_gss/gss_krb5_unseal.c
net/sunrpc/auth_gss/gss_krb5_wrap.c

index f42e453e63eabac6a76e6f39ce74fdf3dc943344..d0bb5064f8c5ae1b0578b8f635cea5d5df0695a4 100644 (file)
@@ -108,17 +108,17 @@ gss_get_mic_kerberos(struct gss_ctx *gss_ctx, struct xdr_buf *text,
        if (krb5_encrypt(ctx->seq, NULL, md5cksum.data,
                          md5cksum.data, md5cksum.len))
                return GSS_S_FAILURE;
-       memcpy(krb5_hdr + 16,
-              md5cksum.data + md5cksum.len - KRB5_CKSUM_LENGTH,
+
+       memcpy(krb5_hdr + 16, md5cksum.data + md5cksum.len - KRB5_CKSUM_LENGTH,
               KRB5_CKSUM_LENGTH);
 
        spin_lock(&krb5_seq_lock);
        seq_send = ctx->seq_send++;
        spin_unlock(&krb5_seq_lock);
 
-       if ((krb5_make_seq_num(ctx->seq, ctx->initiate ? 0 : 0xff,
-                              seq_send, krb5_hdr + 16, krb5_hdr + 8)))
+       if (krb5_make_seq_num(ctx->seq, ctx->initiate ? 0 : 0xff,
+                              ctx->seq_send, krb5_hdr + 16, krb5_hdr + 8))
                return GSS_S_FAILURE;
 
-       return ((ctx->endtime < now) ? GSS_S_CONTEXT_EXPIRED : GSS_S_COMPLETE);
+       return (ctx->endtime < now) ? GSS_S_CONTEXT_EXPIRED : GSS_S_COMPLETE;
 }
index 75a75a6d133657ed12546e28c9f11b83e7c6cf87..87f8977ccece78861cd8d65c1e83007930b82cc0 100644 (file)
@@ -99,16 +99,14 @@ gss_verify_mic_kerberos(struct gss_ctx *gss_ctx,
        /* XXX sanity-check bodysize?? */
 
        signalg = ptr[0] + (ptr[1] << 8);
-       sealalg = ptr[2] + (ptr[3] << 8);
-
-       /* Sanity checks */
-
-       if ((ptr[4] != 0xff) || (ptr[5] != 0xff))
+       if (signalg != SGN_ALG_DES_MAC_MD5)
                return GSS_S_DEFECTIVE_TOKEN;
 
-       if (sealalg != 0xffff)
+       sealalg = ptr[2] + (ptr[3] << 8);
+       if (sealalg != SEAL_ALG_NONE)
                return GSS_S_DEFECTIVE_TOKEN;
-       if (signalg != SGN_ALG_DES_MAC_MD5)
+
+       if ((ptr[4] != 0xff) || (ptr[5] != 0xff))
                return GSS_S_DEFECTIVE_TOKEN;
 
        if (make_checksum("md5", ptr - 2, 8, message_buffer, 0, &md5cksum))
index bf25f4d9acd136af476aae49f7a96776d5a034fa..fe25b3d898dc53951be0c84166df3eae02487817 100644 (file)
@@ -159,7 +159,6 @@ gss_wrap_kerberos(struct gss_ctx *ctx, int offset,
        /* ptr now at byte 2 of header described in rfc 1964, section 1.2.1: */
        krb5_hdr = ptr - 2;
        msg_start = krb5_hdr + 24;
-       /* XXXJBF: */ BUG_ON(buf->head[0].iov_base + offset + headlen != msg_start + blocksize);
 
        *(__be16 *)(krb5_hdr + 2) = htons(SGN_ALG_DES_MAC_MD5);
        memset(krb5_hdr + 4, 0xff, 4);
@@ -196,7 +195,7 @@ gss_wrap_kerberos(struct gss_ctx *ctx, int offset,
                                                                        pages))
                return GSS_S_FAILURE;
 
-       return ((kctx->endtime < now) ? GSS_S_CONTEXT_EXPIRED : GSS_S_COMPLETE);
+       return (kctx->endtime < now) ? GSS_S_CONTEXT_EXPIRED : GSS_S_COMPLETE;
 }
 
 u32
@@ -232,16 +231,14 @@ gss_unwrap_kerberos(struct gss_ctx *ctx, int offset, struct xdr_buf *buf)
        /* get the sign and seal algorithms */
 
        signalg = ptr[0] + (ptr[1] << 8);
-       sealalg = ptr[2] + (ptr[3] << 8);
-
-       /* Sanity checks */
-
-       if ((ptr[4] != 0xff) || (ptr[5] != 0xff))
+       if (signalg != SGN_ALG_DES_MAC_MD5)
                return GSS_S_DEFECTIVE_TOKEN;
 
+       sealalg = ptr[2] + (ptr[3] << 8);
        if (sealalg != SEAL_ALG_DES)
                return GSS_S_DEFECTIVE_TOKEN;
-       if (signalg != SGN_ALG_DES_MAC_MD5)
+
+       if ((ptr[4] != 0xff) || (ptr[5] != 0xff))
                return GSS_S_DEFECTIVE_TOKEN;
 
        if (gss_decrypt_xdr_buf(kctx->enc, buf,