X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fptlrpc%2Fgss%2Fsec_gss.c;h=b5f038be033d9fbb573c5a3192b0f77d6268c613;hb=671c1b0c705640d63a1d3be7016c79afd10bc8df;hp=a830b0d95ba24cae9ab858d51e3b74c380f3e6e0;hpb=21d716e6c16424d9deb646456758ebbaa9c70fec;p=fs%2Flustre-release.git diff --git a/lustre/ptlrpc/gss/sec_gss.c b/lustre/ptlrpc/gss/sec_gss.c index a830b0d..b5f038b 100644 --- a/lustre/ptlrpc/gss/sec_gss.c +++ b/lustre/ptlrpc/gss/sec_gss.c @@ -3,7 +3,7 @@ * * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * - * Copyright (c) 2011, 2013, Intel Corporation. + * Copyright (c) 2011, 2014, Intel Corporation. * * Author: Eric Mei */ @@ -47,7 +47,6 @@ */ #define DEBUG_SUBSYSTEM S_SEC -#ifdef __KERNEL__ #include #include #include @@ -55,9 +54,6 @@ #include #include #include -#else -#include -#endif #include #include @@ -432,43 +428,42 @@ static void gss_cli_ctx_finalize(struct gss_cli_ctx *gctx) rawobj_free(&gctx->gc_handle); } -/* +/** * Based on sequence number algorithm as specified in RFC 2203. * - * modified for our own problem: arriving request has valid sequence number, + * Modified for our own problem: arriving request has valid sequence number, * but unwrapping request might cost a long time, after that its sequence * are not valid anymore (fall behind the window). It rarely happen, mostly * under extreme load. * - * note we should not check sequence before verify the integrity of incoming + * Note we should not check sequence before verifying the integrity of incoming * request, because just one attacking request with high sequence number might - * cause all following request be dropped. + * cause all following requests be dropped. * - * so here we use a multi-phase approach: prepare 2 sequence windows, + * So here we use a multi-phase approach: prepare 2 sequence windows, * "main window" for normal sequence and "back window" for fall behind sequence. * and 3-phase checking mechanism: - * 0 - before integrity verification, perform a initial sequence checking in - * main window, which only try and don't actually set any bits. if the - * sequence is high above the window or fit in the window and the bit + * 0 - before integrity verification, perform an initial sequence checking in + * main window, which only tries and doesn't actually set any bits. if the + * sequence is high above the window or fits in the window and the bit * is 0, then accept and proceed to integrity verification. otherwise * reject this sequence. * 1 - after integrity verification, check in main window again. if this - * sequence is high above the window or fit in the window and the bit - * is 0, then set the bit and accept; if it fit in the window but bit - * already set, then reject; if it fall behind the window, then proceed + * sequence is high above the window or fits in the window and the bit + * is 0, then set the bit and accept; if it fits in the window but bit + * already set, then reject; if it falls behind the window, then proceed * to phase 2. - * 2 - check in back window. if it is high above the window or fit in the + * 2 - check in back window. if it is high above the window or fits in the * window and the bit is 0, then set the bit and accept. otherwise reject. * - * return value: - * 1: looks like a replay - * 0: is ok - * -1: is a replay + * \return 1: looks like a replay + * \return 0: is ok + * \return -1: is a replay * - * note phase 0 is necessary, because otherwise replay attacking request of + * Note phase 0 is necessary, because otherwise replay attacking request of * sequence which between the 2 windows can't be detected. * - * this mechanism can't totally solve the problem, but could help much less + * This mechanism can't totally solve the problem, but could help reduce the * number of valid requests be dropped. */ static @@ -1128,7 +1123,7 @@ int gss_sec_create_common(struct gss_sec *gsec, sec->ps_flvr = *sf; sec->ps_import = class_import_get(imp); spin_lock_init(&sec->ps_lock); - CFS_INIT_LIST_HEAD(&sec->ps_gc_list); + INIT_LIST_HEAD(&sec->ps_gc_list); if (!svcctx) { sec->ps_gc_interval = GSS_GC_INTERVAL; @@ -1184,7 +1179,7 @@ int gss_cli_ctx_init_common(struct ptlrpc_sec *sec, gctx->gc_win = 0; atomic_set(&gctx->gc_seq, 0); - CFS_INIT_HLIST_NODE(&ctx->cc_cache); + INIT_HLIST_NODE(&ctx->cc_cache); atomic_set(&ctx->cc_refcount, 0); ctx->cc_sec = sec; ctx->cc_ops = ctxops; @@ -1192,8 +1187,8 @@ int gss_cli_ctx_init_common(struct ptlrpc_sec *sec, ctx->cc_flags = PTLRPC_CTX_NEW; ctx->cc_vcred = *vcred; spin_lock_init(&ctx->cc_lock); - CFS_INIT_LIST_HEAD(&ctx->cc_req_list); - CFS_INIT_LIST_HEAD(&ctx->cc_gc_chain); + INIT_LIST_HEAD(&ctx->cc_req_list); + INIT_LIST_HEAD(&ctx->cc_gc_chain); /* take a ref on belonging sec, balanced in ctx destroying */ atomic_inc(&sec->ps_refcount); @@ -2874,7 +2869,7 @@ static void gss_init_at_reply_offset(void) gss_at_reply_off_priv = lustre_msg_size_v2(3, buflens); } -int __init sptlrpc_gss_init(void) +static int __init sptlrpc_gss_init(void) { int rc; @@ -2944,8 +2939,9 @@ static void __exit sptlrpc_gss_exit(void) gss_exit_lproc(); } -MODULE_AUTHOR("Sun Microsystems, Inc. "); -MODULE_DESCRIPTION("GSS security policy for Lustre"); +MODULE_AUTHOR("OpenSFS, Inc. "); +MODULE_DESCRIPTION("Lustre GSS security policy"); +MODULE_VERSION(LUSTRE_VERSION_STRING); MODULE_LICENSE("GPL"); module_init(sptlrpc_gss_init);