#include <obd_class.h>
#include <obd_support.h>
#include <lustre/lustre_idl.h>
-#include <lustre_net.h>
#include <lustre_import.h>
+#include <lustre_net.h>
+#include <lustre_nodemap.h>
#include <lustre_sec.h>
#include "gss_err.h"
#endif
}
/****************************************
- * rsi cache *
+ * rpc sec init (rsi) cache *
****************************************/
#define RSI_HASHBITS (6)
struct cache_head h;
__u32 lustre_svc;
__u64 nid;
+ char nm_name[LUSTRE_NODEMAP_NAME_LENGTH + 1];
wait_queue_head_t waitq;
rawobj_t in_handle, in_token;
rawobj_t out_handle, out_token;
rawobj_free(&rsi->out_token);
}
+/* See handle_channel_req() userspace for where the upcall data is read */
static void rsi_request(struct cache_detail *cd,
struct cache_head *h,
char **bpp, int *blen)
sizeof(rsi->lustre_svc));
qword_addhex(bpp, blen, (char *) &rsi->nid, sizeof(rsi->nid));
qword_addhex(bpp, blen, (char *) &index, sizeof(index));
+ qword_addhex(bpp, blen, (char *) rsi->nm_name,
+ strlen(rsi->nm_name) + 1);
qword_addhex(bpp, blen, rsi->in_handle.data, rsi->in_handle.len);
qword_addhex(bpp, blen, rsi->in_token.data, rsi->in_token.len);
(*bpp)[-1] = '\n';
new->lustre_svc = item->lustre_svc;
new->nid = item->nid;
+ memcpy(new->nm_name, item->nm_name, sizeof(item->nm_name));
init_waitqueue_head(&new->waitq);
}
}
/****************************************
- * rsc cache *
+ * rpc sec context (rsc) cache *
****************************************/
#define RSC_HASHBITS (10)
rscp->target = imp->imp_obd;
rawobj_dup(&gctx->gc_svc_handle, &rscp->handle);
- CWARN("create reverse svc ctx %p to %s: idx "LPX64"\n",
+ CWARN("create reverse svc ctx %p to %s: idx %#llx\n",
&rscp->ctx, obd2cli_tgt(imp->imp_obd), gsec->gs_rvs_hdl);
rc = 0;
out:
rsc_free(&rsci);
if (rc)
- CERROR("create reverse svc ctx: idx "LPX64", rc %d\n",
+ CERROR("create reverse svc ctx: idx %#llx, rc %d\n",
gsec->gs_rvs_hdl, rc);
RETURN(rc);
}
int rc = SECSVC_DROP;
ENTRY;
- memset(&rsikey, 0, sizeof(rsikey));
- rsikey.lustre_svc = lustre_svc;
- rsikey.nid = (__u64) req->rq_peer.nid;
+ memset(&rsikey, 0, sizeof(rsikey));
+ rsikey.lustre_svc = lustre_svc;
+ rsikey.nid = (__u64) req->rq_peer.nid;
+ nodemap_test_nid(req->rq_peer.nid, rsikey.nm_name,
+ sizeof(rsikey.nm_name));
/* duplicate context handle. for INIT it always 0 */
if (rawobj_dup(&rsikey.in_handle, &gw->gw_handle)) {
if (!rsci) {
CERROR("authentication failed\n");
- if (!gss_pack_err_notify(req, GSS_S_FAILURE, 0))
- rc = SECSVC_COMPLETE;
+ /* gss mechanism returned major and minor code so we return
+ * those in error message */
+ if (!gss_pack_err_notify(req, rsip->major_status,
+ rsip->minor_status))
+ rc = SECSVC_COMPLETE;
GOTO(out, rc);
} else {
rc = SECSVC_OK;
out:
- /* it looks like here we should put rsip also, but this mess up
- * with NFS cache mgmt code... FIXME */
-#if 0
- if (rsip)
- rsi_put(&rsip->h, &rsi_cache);
-#endif
-
- if (rsci) {
- /* if anything went wrong, we don't keep the context too */
- if (rc != SECSVC_OK)
+ /* it looks like here we should put rsip also, but this mess up
+ * with NFS cache mgmt code... FIXME
+ * something like:
+ * if (rsip)
+ * rsi_put(&rsip->h, &rsi_cache); */
+
+ if (rsci) {
+ /* if anything went wrong, we don't keep the context too */
+ if (rc != SECSVC_OK)
set_bit(CACHE_NEGATIVE, &rsci->h.flags);
- else
- CDEBUG(D_SEC, "create rsc with idx "LPX64"\n",
- gss_handle_to_u64(&rsci->handle));
+ else
+ CDEBUG(D_SEC, "create rsc with idx %#llx\n",
+ gss_handle_to_u64(&rsci->handle));
- COMPAT_RSC_PUT(&rsci->h, &rsc_cache);
- }
- RETURN(rc);
+ COMPAT_RSC_PUT(&rsci->h, &rsc_cache);
+ }
+ RETURN(rc);
}
struct gss_svc_ctx *gss_svc_upcall_get_ctx(struct ptlrpc_request *req,
rsc = gss_svc_searchbyctx(&gw->gw_handle);
if (!rsc) {
- CWARN("Invalid gss ctx idx "LPX64" from %s\n",
+ CWARN("Invalid gss ctx idx %#llx from %s\n",
gss_handle_to_u64(&gw->gw_handle),
libcfs_nid2str(req->rq_peer.nid));
return NULL;