* vim:expandtab:shiftwidth=8:tabstop=8:
*
* Modifications for Lustre
- * Copyright 2004 - 2007, Cluster File Systems, Inc.
- * All rights reserved
+ *
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved
+ *
* Author: Eric Mei <ericm@clusterfs.com>
*/
struct gss_header *ghdr, *reqhdr;
struct lustre_msg *msg = req->rq_repdata;
__u32 major;
- int pack_bulk, early = 0, rc = 0;
+ int pack_bulk, rc = 0;
ENTRY;
LASSERT(req->rq_cli_ctx == ctx);
gctx = container_of(ctx, struct gss_cli_ctx, gc_base);
- if ((char *) msg < req->rq_repbuf ||
- (char *) msg >= req->rq_repbuf + req->rq_repbuf_len)
- early = 1;
-
/* special case for context negotiation, rq_repmsg/rq_replen actually
* are not used currently. but early reply always be treated normally */
- if (req->rq_ctx_init && !early) {
+ if (req->rq_ctx_init && !req->rq_early) {
req->rq_repmsg = lustre_msg_buf(msg, 1, 0);
req->rq_replen = msg->lm_buflens[1];
RETURN(0);
case PTLRPC_GSS_PROC_DATA:
pack_bulk = ghdr->gh_flags & LUSTRE_GSS_PACK_BULK;
- if (!early && !equi(req->rq_pack_bulk == 1, pack_bulk)) {
+ if (!req->rq_early && !equi(req->rq_pack_bulk == 1, pack_bulk)){
CERROR("%s bulk flag in reply\n",
req->rq_pack_bulk ? "missing" : "unexpected");
RETURN(-EPROTO);
if (major != GSS_S_COMPLETE)
RETURN(-EPERM);
- if (early && reqhdr->gh_svc == SPTLRPC_SVC_NULL) {
+ if (req->rq_early && reqhdr->gh_svc == SPTLRPC_SVC_NULL) {
__u32 cksum;
cksum = crc32_le(!(__u32) 0,
req->rq_replen = msg->lm_buflens[1];
break;
case PTLRPC_GSS_PROC_ERR:
- if (early) {
+ if (req->rq_early) {
CERROR("server return error with early reply\n");
rc = -EPROTO;
} else {
struct gss_cli_ctx *gctx;
rawobj_t hdrobj, msgobj, token;
struct gss_header *ghdr;
- int buflens[2], wiresize, rc;
- __u32 major;
+ __u32 buflens[2], major;
+ int wiresize, rc;
ENTRY;
LASSERT(req->rq_clrbuf);
struct gss_cli_ctx *gctx;
struct gss_header *ghdr;
struct lustre_msg *msg = req->rq_repdata;
- int msglen, pack_bulk, early = 0, rc;
+ int msglen, pack_bulk, rc;
__u32 major;
ENTRY;
gctx = container_of(ctx, struct gss_cli_ctx, gc_base);
- if ((char *) msg < req->rq_repbuf ||
- (char *) msg >= req->rq_repbuf + req->rq_repbuf_len)
- early = 1;
-
ghdr = gss_swab_header(msg, 0);
if (ghdr == NULL) {
CERROR("can't decode gss header\n");
case PTLRPC_GSS_PROC_DATA:
pack_bulk = ghdr->gh_flags & LUSTRE_GSS_PACK_BULK;
- if (!early && !equi(req->rq_pack_bulk == 1, pack_bulk)) {
+ if (!req->rq_early && !equi(req->rq_pack_bulk == 1, pack_bulk)){
CERROR("%s bulk flag in reply\n",
req->rq_pack_bulk ? "missing" : "unexpected");
RETURN(-EPROTO);
rc = 0;
break;
case PTLRPC_GSS_PROC_ERR:
- rc = gss_cli_ctx_handle_err_notify(ctx, req, ghdr);
+ if (req->rq_early) {
+ CERROR("server return error with early reply\n");
+ rc = -EPROTO;
+ } else {
+ rc = gss_cli_ctx_handle_err_notify(ctx, req, ghdr);
+ }
break;
default:
CERROR("unexpected proc %d\n", ghdr->gh_proc);
sec->ps_id = sptlrpc_get_next_secid();
sec->ps_flvr = *sf;
sec->ps_import = class_import_get(imp);
- sec->ps_lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&sec->ps_lock);
CFS_INIT_LIST_HEAD(&sec->ps_gc_list);
if (!svcctx) {
int svc, int msgsize)
{
int bufsize, txtsize;
- int buflens[5], bufcnt = 2;
+ int bufcnt = 2;
+ __u32 buflens[5];
ENTRY;
/*
struct ptlrpc_request *req,
int msgsize)
{
- int ibuflens[3], ibufcnt;
- int wbuflens[2];
+ __u32 ibuflens[3], wbuflens[2];
+ int ibufcnt;
int clearsize, wiresize;
ENTRY;
int svc, int msgsize)
{
int txtsize;
- int buflens[4], bufcnt = 2;
+ __u32 buflens[4];
+ int bufcnt = 2;
int alloc_size;
/*
int msgsize)
{
int txtsize;
- int buflens[2], bufcnt;
+ __u32 buflens[2];
+ int bufcnt;
int alloc_size;
/* inner buffers */
{
struct lustre_msg *newclrbuf;
int newmsg_size, newclrbuf_size, newcipbuf_size;
- int buflens[3];
+ __u32 buflens[3];
/*
* embedded msg is at seg 0 of clear buffer;
rs->rs_repdata_len = rc;
if (likely(req->rq_packed_final)) {
- req->rq_reply_off = gss_at_reply_off_integ;
+ if (lustre_msghdr_get_flags(req->rq_reqmsg) & MSGHDR_AT_SUPPORT)
+ req->rq_reply_off = gss_at_reply_off_integ;
+ else
+ req->rq_reply_off = 0;
} else {
if (svc == SPTLRPC_SVC_NULL)
rs->rs_repbuf->lm_cksum = crc32_le(!(__u32) 0,
struct gss_svc_reqctx *grctx;
struct ptlrpc_reply_state *rs;
int early, privacy, svc, bsd_off = 0;
- int ibuflens[2], ibufcnt = 0;
- int buflens[4], bufcnt;
+ __u32 ibuflens[2], buflens[4];
+ int ibufcnt = 0, bufcnt;
int txtsize, wmsg_size, rs_size;
ENTRY;
rawobj_t hdrobj, msgobj, token;
struct gss_header *ghdr;
__u8 *token_buf;
- int token_buflen, buflens[2];
+ int token_buflen;
+ __u32 buflens[2], major;
int msglen, rc;
- __u32 major;
ENTRY;
/* get clear data length. note embedded lustre_msg might
memcpy(lustre_msg_buf(rs->rs_repbuf, 1, 0), token.data, token.len);
/* reply offset */
- if (likely(req->rq_packed_final))
+ if (req->rq_packed_final &&
+ (lustre_msghdr_get_flags(req->rq_reqmsg) & MSGHDR_AT_SUPPORT))
req->rq_reply_off = gss_at_reply_off_priv;
else
req->rq_reply_off = 0;
static void gss_init_at_reply_offset(void)
{
- int buflens[3], clearsize;
+ __u32 buflens[3];
+ int clearsize;
buflens[0] = PTLRPC_GSS_HEADER_SIZE;
buflens[1] = lustre_msg_early_size();
gss_exit_lproc();
}
-MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
+MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>");
MODULE_DESCRIPTION("GSS security policy for Lustre");
MODULE_LICENSE("GPL");