RPC: Save the name of the principal in the gss_cred Signed-off-by: Trond Myklebust --- include/linux/sunrpc/auth_gss.h | 1 + net/sunrpc/auth_gss/auth_gss.c | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) Index: linux-2.6.12-rc1/include/linux/sunrpc/auth_gss.h =================================================================== --- linux-2.6.12-rc1.orig/include/linux/sunrpc/auth_gss.h +++ linux-2.6.12-rc1/include/linux/sunrpc/auth_gss.h @@ -75,6 +75,7 @@ struct gss_cl_ctx { struct xdr_netobj gc_wire_ctx; u32 gc_win; unsigned long gc_expiry; + char gc_principal[0]; }; struct gss_upcall_msg; Index: linux-2.6.12-rc1/net/sunrpc/auth_gss/auth_gss.c =================================================================== --- linux-2.6.12-rc1.orig/net/sunrpc/auth_gss/auth_gss.c +++ linux-2.6.12-rc1/net/sunrpc/auth_gss/auth_gss.c @@ -221,17 +221,19 @@ gss_cred_get_ctx(struct rpc_cred *cred) } static struct gss_cl_ctx * -gss_alloc_context(void) +gss_alloc_context(const char *principal) { struct gss_cl_ctx *ctx; + size_t len = strlen(principal) + 1; - ctx = kmalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kmalloc(sizeof(*ctx) + len, GFP_KERNEL); if (ctx != NULL) { memset(ctx, 0, sizeof(*ctx)); ctx->gc_proc = RPC_GSS_PROC_DATA; ctx->gc_seq = 1; /* NetApp 6.4R1 doesn't accept seq. no. 0 */ spin_lock_init(&ctx->gc_seq_lock); atomic_set(&ctx->count,1); + memcpy(ctx->gc_principal, principal, len); } return ctx; } @@ -535,6 +537,7 @@ gss_pipe_downcall(struct file *filp, con struct rpc_cred *cred; struct gss_upcall_msg *gss_msg; struct gss_cl_ctx *ctx; + char principal[32]; uid_t uid; int err = -EFBIG; @@ -558,7 +561,8 @@ gss_pipe_downcall(struct file *filp, con } err = -ENOMEM; - ctx = gss_alloc_context(); + snprintf(principal, sizeof(principal), "%u@%s", uid, clnt->cl_server); + ctx = gss_alloc_context(principal); if (ctx == NULL) goto err; err = 0;