Whamcloud - gitweb
LU-2675 mdc: remove mdc_sendpage()
[fs/lustre-release.git] / lustre / ptlrpc / gss / gss_bulk.c
index f8723f5..1f0c06e 100644 (file)
@@ -1,6 +1,4 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
  * GPL HEADER START
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -26,7 +24,7 @@
  * GPL HEADER END
  */
 /*
- * Copyright  2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  */
 /*
  * Author: Eric Mei <eric.mei@sun.com>
  */
 
-#ifndef EXPORT_SYMTAB
-# define EXPORT_SYMTAB
-#endif
 #define DEBUG_SUBSYSTEM S_SEC
-#ifdef __KERNEL__
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/dcache.h>
 #include <linux/fs.h>
-#include <linux/random.h>
 #include <linux/mutex.h>
 #include <linux/crypto.h>
-#else
-#include <liblustre.h>
-#endif
 
 #include <obd.h>
 #include <obd_class.h>
@@ -189,31 +179,31 @@ int gss_cli_ctx_unwrap_bulk(struct ptlrpc_cli_ctx *ctx,
         switch (SPTLRPC_FLVR_SVC(req->rq_flvr.sf_rpc)) {
         case SPTLRPC_SVC_NULL:
                 vmsg = req->rq_repdata;
+               LASSERT(vmsg != NULL && vmsg->lm_bufcount >= 3);
                 voff = vmsg->lm_bufcount - 1;
-                LASSERT(vmsg && vmsg->lm_bufcount >= 3);
 
                 rmsg = req->rq_reqbuf;
+               LASSERT(rmsg != NULL && rmsg->lm_bufcount >= 3);
                 roff = rmsg->lm_bufcount - 1; /* last segment */
-                LASSERT(rmsg && rmsg->lm_bufcount >= 3);
                 break;
         case SPTLRPC_SVC_AUTH:
         case SPTLRPC_SVC_INTG:
                 vmsg = req->rq_repdata;
+               LASSERT(vmsg != NULL && vmsg->lm_bufcount >= 4);
                 voff = vmsg->lm_bufcount - 2;
-                LASSERT(vmsg && vmsg->lm_bufcount >= 4);
 
                 rmsg = req->rq_reqbuf;
+               LASSERT(rmsg != NULL && rmsg->lm_bufcount >= 4);
                 roff = rmsg->lm_bufcount - 2; /* second last segment */
-                LASSERT(rmsg && rmsg->lm_bufcount >= 4);
                 break;
         case SPTLRPC_SVC_PRIV:
                 vmsg = req->rq_repdata;
+               LASSERT(vmsg != NULL && vmsg->lm_bufcount >= 2);
                 voff = vmsg->lm_bufcount - 1;
-                LASSERT(vmsg && vmsg->lm_bufcount >= 2);
 
                 rmsg = req->rq_clrbuf;
+               LASSERT(rmsg != NULL && rmsg->lm_bufcount >= 2);
                 roff = rmsg->lm_bufcount - 1; /* last segment */
-                LASSERT(rmsg && rmsg->lm_bufcount >= 2);
                 break;
         default:
                 LBUG();
@@ -291,7 +281,8 @@ int gss_cli_ctx_unwrap_bulk(struct ptlrpc_cli_ctx *ctx,
                         token.len = lustre_msg_buflen(vmsg, voff) -
                                     sizeof(*bsdr);
 
-                        maj = lgss_unwrap_bulk(gctx->gc_mechctx, desc, &token);
+                        maj = lgss_unwrap_bulk(gctx->gc_mechctx, desc,
+                                               &token, 1);
                         if (maj != GSS_S_COMPLETE) {
                                 CERROR("failed to decrypt bulk read: %x\n",
                                        maj);
@@ -433,7 +424,7 @@ int gss_svc_unwrap_bulk(struct ptlrpc_request *req,
                 token.len = grctx->src_reqbsd_size - sizeof(*bsdr);
 
                 maj = lgss_unwrap_bulk(grctx->src_ctx->gsc_mechctx,
-                                       desc, &token);
+                                       desc, &token, 0);
                 if (maj != GSS_S_COMPLETE) {
                         bsdv->bsd_flags |= BSD_FL_ERR;
                         CERROR("failed decrypt bulk data: %x\n", maj);