* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2012, Intel Corporation.
+ * Copyright (c) 2012, 2014, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
}
#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)
{
LASSERT(timer);
CDEBUG(D_SEC, "ctx %p: start timer %lds\n", ctx, timeout);
- timeout = timeout * HZ + cfs_time_current();
+ timeout = msecs_to_jiffies(timeout * MSEC_PER_SEC) +
+ cfs_time_current();
init_timer(timer);
timer->expires = timeout;
* 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:
if (coinfo == NULL)
goto out;
- snprintf(coinfo, coinfo_size, "%d:%s:%u:%u:%s:%d:"LPX64":%s",
- sec->ps_id, sec2gsec(sec)->gs_mech->gm_name,
- vcred->vc_uid, vcred->vc_gid,
- co_flags, import_to_gss_svc(imp),
- imp->imp_connection->c_peer.nid, imp->imp_obd->obd_name);
+ snprintf(coinfo, coinfo_size, "%d:%s:%u:%u:%s:%d:"LPX64":%s:"LPX64,
+ sec->ps_id, sec2gsec(sec)->gs_mech->gm_name,
+ vcred->vc_uid, vcred->vc_gid,
+ co_flags, import_to_gss_svc(imp),
+ imp->imp_connection->c_peer.nid, imp->imp_obd->obd_name,
+ imp->imp_connection->c_self);
CDEBUG(D_SEC, "requesting key for %s\n", desc);
****************************************/
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;
RETURN(-EINVAL);
}
- if (key->payload.data != 0) {
+ if (key->payload.data != NULL) {
CERROR("key already have payload\n");
RETURN(-EINVAL);
}
* 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