X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fptlrpc%2Fgss%2Fgss_keyring.c;h=5256adc0ff1af21d63cfd9a34993f86014430a45;hb=37e738fbde6220164da7b9c2097065eb323e2da7;hp=c0438e9a18b9cd1cd47a04aefd7ccf1a8beb054d;hpb=0d88b3296cf28c8222359f9a19e42e423e2e3b28;p=fs%2Flustre-release.git diff --git a/lustre/ptlrpc/gss/gss_keyring.c b/lustre/ptlrpc/gss/gss_keyring.c index c0438e9..5256adc 100644 --- a/lustre/ptlrpc/gss/gss_keyring.c +++ b/lustre/ptlrpc/gss/gss_keyring.c @@ -118,7 +118,11 @@ static int sec_install_rctx_kr(struct ptlrpc_sec *sec, } #define key_cred(tsk) ((tsk)->cred) +#ifdef HAVE_CRED_TGCRED #define key_tgcred(tsk) ((tsk)->cred->tgcred) +#else +#define key_tgcred(tsk) key_cred(tsk) +#endif static inline void keyring_upcall_lock(struct gss_sec_keyring *gsec_kr) { @@ -747,6 +751,17 @@ struct ptlrpc_cli_ctx * gss_sec_lookup_ctx_kr(struct ptlrpc_sec *sec, * encode real uid/gid into callout info. */ + /* But first we need to make sure the obd type is supported */ + if (strcmp(imp->imp_obd->obd_type->typ_name, LUSTRE_MDC_NAME) && + strcmp(imp->imp_obd->obd_type->typ_name, LUSTRE_OSC_NAME) && + strcmp(imp->imp_obd->obd_type->typ_name, LUSTRE_MGC_NAME) && + strcmp(imp->imp_obd->obd_type->typ_name, LUSTRE_LWP_NAME) && + strcmp(imp->imp_obd->obd_type->typ_name, LUSTRE_OSP_NAME)) { + CERROR("obd %s is not a supported device\n", + imp->imp_obd->obd_name); + GOTO(out, ctx = NULL); + } + construct_key_desc(desc, sizeof(desc), sec, vcred->vc_uid); /* callout info format: @@ -1217,8 +1232,15 @@ int gss_svc_install_rctx_kr(struct obd_import *imp, ****************************************/ static +#ifdef HAVE_KEY_TYPE_INSTANTIATE_2ARGS +int gss_kt_instantiate(struct key *key, struct key_preparsed_payload *prep) +{ + const void *data = prep->data; + size_t datalen = prep->datalen; +#else int gss_kt_instantiate(struct key *key, const void *data, size_t datalen) { +#endif int rc; ENTRY; @@ -1263,19 +1285,26 @@ int gss_kt_instantiate(struct key *key, const void *data, size_t datalen) * on the context without fear of loosing refcount. */ static +#ifdef HAVE_KEY_TYPE_INSTANTIATE_2ARGS +int gss_kt_update(struct key *key, struct key_preparsed_payload *prep) +{ + const void *data = prep->data; + __u32 datalen32 = (__u32) prep->datalen; +#else int gss_kt_update(struct key *key, const void *data, size_t datalen) { + __u32 datalen32 = (__u32) datalen; +#endif struct ptlrpc_cli_ctx *ctx = key->payload.data; struct gss_cli_ctx *gctx; rawobj_t tmpobj = RAWOBJ_EMPTY; - __u32 datalen32 = (__u32) datalen; int rc; ENTRY; - if (data == NULL || datalen == 0) { - CWARN("invalid: data %p, len %lu\n", data, (long)datalen); - RETURN(-EINVAL); - } + if (data == NULL || datalen32 == 0) { + CWARN("invalid: data %p, len %lu\n", data, (long)datalen32); + RETURN(-EINVAL); + } /* if upcall finished negotiation too fast (mostly likely because * of local error happened) and call kt_update(), the ctx